title: Can't read Web.config with ConfigurationManager.AppSettings
body: <p>I have build a WCF service that uses Web.config to get some appSettings. In visual studio it works great but when I publish and instal the service it suddenly gets its appSettings from App.config and not from Web.config.</p>
  
  <p>I know this because I loop through appSettings and printed the result to the console with this code:</p>
  
  <pre><code>foreach (string key in ConfigurationManager.AppSettings.AllKeys)
  {
       Console.WriteLine("Name: {0} Value: {1}", key, ConfigurationManager.AppSettings[key]);
  }
  </code></pre>
  
  <p>My configs look like this:</p>
  
  <p><strong>Web.config</strong></p>
  
  <pre><code>  ....
    &lt;appSettings&gt;
      &lt;add key="IQDir" value="C:\Program Files (x86)\Ridder iQ Client (lokaal)\Bin"/&gt;
      &lt;add key="FileURL" value="localhost:8080/WebPortal_2.0/"/&gt;
    &lt;/appSettings&gt;
    ....
  </code></pre>
  
  <p><strong>App.config</strong></p>
  
  <pre><code>....
    &lt;appSettings&gt;
      &lt;add key="test1" value="wtf is going on!"/&gt;
      &lt;add key="test2" value="waargh"/&gt;
      &lt;add key="test3" value="I am getting a headache over here!!"/&gt;
    &lt;/appSettings&gt;
  ....
  </code></pre>
  
  <p>When I run in visual studio I get:</p>
  
  <p><img src="https://i.stack.imgur.com/OLMUZ.png" alt="enter image description here"></p>
  
  <p>But when I use the published code inside live environment I get this:</p>
  
  <p><img src="https://i.stack.imgur.com/6PgR8.png" alt="enter image description here"></p>
  
  <p>Why is this happening and how can I force <code>ConfigurationManager</code> to get appSettings from Web.config instead of App.config.</p>