title: Can't get values from App.config file (framework 4.0)
body: <p>i have a config file like this:</p>
  
  <pre><code>?xml version="1.0" encoding="utf-8" ?
  
  configuration
  
    appSettings
  
      add key="PortName" value="COM4"
  
      add key="BaudRate" value="9600"
  
     add key="DataBits" value="8" 
  
    appSettings
  
  configuration
  </code></pre>
  
  <p>... and then i want to access app.config values with this code:</p>
  
  <pre><code>using System;
  
  using System.Collections.Generic;
  
  using System.Linq;
  
  using System.Text;
  
  using System.IO.Ports;
  
  using System.Configuration;
  
  
  namespace SystemToControler
  
  {
  
      public class ConnectionProtocol : IConnectionProtocol
      {
          SerialPort serialPort = new SerialPort();
  
          public ConnectionProtocol()
          {
              serialPort.PortName = ConfigurationManager.AppSettings["PortName"];
              serialPort.BaudRate = Convert.ToInt32(ConfigurationManager.AppSettings["BaudRate"]);
              serialPort.DataBits = Convert.ToInt32(ConfigurationManager.AppSettings["DataBits"]);
          }
      }
  }
  </code></pre>
  
  <p>... and it tells me i that those keys does not exist.</p>
  
  <p>What am i doing wrong??? Please help!</p>