title: C# Web API connectionstrings web.config not being read
body: <p>This is my first question here, so please be gentle (and provide constructive criticism as to how I can improve my question) :)</p>
  
  <p>I'm trying to connect to an Oracle Database in my Web API project.
  This project has an app.config and a web.config.
  I don't know why I have both, but it came with that when setting up the (empty asp.net with Web API) project.</p>
  
  <p>This is my code to connect to the database and get the connection string, which is also where I get the NullReferenceException:</p>
  
  <pre><code>// create a connection to the database
  using (var con = new OracleConnection(ConfigurationManager.ConnectionStrings["Oracle"].ConnectionString))
  </code></pre>
  
  <p>And I have included the appropriate using-statements:</p>
  
  <pre><code>using Oracle.ManagedDataAccess.Client;
  using System.Configuration;
  using System.Data;
  using Oracle.ManagedDataAccess.Types;
  </code></pre>
  
  <p>My web.config file is as follows:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;oracle.manageddataaccess.client&gt;
      &lt;version number="*"&gt;
        &lt;dataSources&gt;
          &lt;!-- Customize these connection alias settings to connect to Oracle DB --&gt;
          &lt;dataSource alias="ALIAS" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=IPOFSERVER)(PORT=PORTOFSERVER))(CONNECT_DATA=(SERVICE_NAME=SERVICENAME)));User Id=USERNAME;Password=PASSWORD;" /&gt;
        &lt;/dataSources&gt;
      &lt;/version&gt;
    &lt;/oracle.manageddataaccess.client&gt;
    &lt;connectionStrings&gt;
      &lt;clear/&gt;
      &lt;add name="Oracle" connectionString="Data Source=ALIAS;" providerName="Oracle.ManagedDataAccess.Client"/&gt;
    &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Things I've tried so far:</p>
  
  <ul>
  <li>Using System.Web.Configuration.WebConfigurationManager instead</li>
  <li>Checking references etc.</li>
  <li>Adding AppSettings key and value and try to read that from the web.config file. Also returns null.</li>
  </ul>
  
  <p>I'm not getting any errors other than the runtime NullReferenceException.
  I hope this is enough information to suggest a solution. If not, please let me know and I'll provide extra info.</p>