title: Oracle.ManagedDataAccess: TNS:could not resolve the connect identifier specified
body: <p>I'm getting the following error while trying to connect to an Oracle database from a new ASP.NET MVC 4 application: "ORA-12154: TNS:could not resolve the connect identifier specified".  I'm using the Oracle.ManagedDataAccess DLL (version 4.121.1.0) to try to connect to an Oracle 10g database.  Here's the thing - I have an integration test assembly that is successfully connecting to the database using this minimal App.config:</p>
  
  <pre><code>  &lt;connectionStrings&gt;
      &lt;add name="OracleConnection" connectionString="DATA SOURCE=TNS_NAME;PASSWORD=xxx;PERSIST SECURITY INFO=True;USER ID=xxx" providerName="Oracle.ManagedDataAccess.Client" /&gt;
    &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>However, if I try to run my web app with all the crazy Web.config settings, I'm getting the error "ORA-12154: TNS:could not resolve the connect identifier specified".  What am I doing wrong?  Why is my config for the integration test assembly so simple and the Web.config so complex?  Here's the pertinent sections of my Web.config (taken from <a href="https://stackoverflow.com/questions/13721025/deploying-and-configuring-odp-net-to-work-without-installation-with-entity-frame">Deploying and Configuring ODP.NET to work without installation with Entity Framework</a>):</p>
  
  <p>custom configSection:</p>
  
  <pre><code>&lt;configSections&gt;
      &lt;section name="oracle.manageddataaccess.client"
          type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /&gt;
    &lt;/configSections&gt;
  </code></pre>
  
  <p>the corresponding config section:</p>
  
  <pre><code>  &lt;oracle.manageddataaccess.client&gt;
      &lt;version number="*"&gt;
        &lt;edmMappings&gt;
          &lt;edmMapping dataType="number"&gt;
            &lt;add name="bool" precision="1"/&gt;
            &lt;add name="byte" precision="2" /&gt;
            &lt;add name="int16" precision="5" /&gt;
          &lt;/edmMapping&gt;
        &lt;/edmMappings&gt;
      &lt;/version&gt;
    &lt;/oracle.manageddataaccess.client&gt;
  </code></pre>
  
  <p>custom system.data node:</p>
  
  <pre><code>  &lt;system.data&gt;
      &lt;DbProviderFactories&gt;
         Remove in case this is already defined in machine.config 
        &lt;remove invariant="Oracle.DataAccess.Client" /&gt;
        &lt;remove invariant="Oracle.ManagedDataAccess.Client" /&gt;
        &lt;add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client"
               description="Oracle Data Provider for .NET, Managed Driver"
               type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /&gt;
      &lt;/DbProviderFactories&gt;
    &lt;/system.data&gt;
  </code></pre>
  
  <p>EntityFramework node:</p>
  
  <pre><code>  &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="Victoria.Data.OracleConnectionFactory, EntityFramework" /&gt;
    &lt;/entityFramework&gt;
  </code></pre>
  
  <p><strong>Update 1</strong>: After reading through <a href="http://docs.oracle.com/cd/E16655_01/win.121/e17732/featConfig.htm#ODPNT8161" rel="nofollow noreferrer">http://docs.oracle.com/cd/E16655_01/win.121/e17732/featConfig.htm#ODPNT8161</a>, I tried modifying my Web.config oracle.manageddataaccess.client to the following and it works.  However, it doesn't seem right to have the connectionString node referencing the TNS name AND this extra reference to the same TNS Names file.</p>
  
  <pre><code>  &lt;oracle.manageddataaccess.client&gt;
      &lt;version number="*"&gt;
        &lt;dataSources&gt;
          &lt;dataSource alias="SIEBMATS" descriptor="(DESCRIPTION=(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.yyy.zzz)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = siebmats)))" /&gt;
        &lt;/dataSources&gt;
        &lt;edmMappings&gt;
          &lt;edmMapping dataType="number"&gt;
            &lt;add name="bool" precision="1"/&gt;
            &lt;add name="byte" precision="2" /&gt;
            &lt;add name="int16" precision="5" /&gt;
          &lt;/edmMapping&gt;
        &lt;/edmMappings&gt;
      &lt;/version&gt;
    &lt;/oracle.manageddataaccess.client&gt;
  </code></pre>