title: How do I setup tnsnames.ora in asp.net core web application?
body: <p>I have a small asp.net core 2.2 app that should access an oracle db; I'm using NuGet Oracle.ManagedDataAccess.Core (2.18.6), and it just works on my machine.</p>
  
  <p>When I deploy it to the windows server with IIS, I place a <code>tnsnames.ora</code> file in app's directory and again it just works.</p>
  
  <p>Now I want to use a shared <code>tnsnames.ora</code> file. I have tried <code>web.config</code> like following (recipy from StackOverflow/Google answers to similar questions).</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Culture=neutral, PublicKeyToken=89b483f429c47342"/&gt;
    &lt;/configSections&gt;
  
    &lt;!-- skipping app stuff --&gt;
  
    &lt;oracle.manageddataaccess.client&gt;
      &lt;version number="*"&gt;
        &lt;settings&gt;
          &lt;setting name="tns_admin" value="F:\path\to\tnsadmin\folder" /&gt;
        &lt;/settings&gt;
      &lt;/version&gt;
    &lt;/oracle.manageddataaccess.client&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Unfortunately, this doesn't work (and since the Core version of <code>Oracle.ManagedDataAccess.dll</code> doesn't have an <code>ODPMSectionHandler</code> class it isn't a big surprise).</p>
  
  <p>So, is there a way to have a shared <code>tnsnames.ora</code> file with odp.net core?</p>
  
  <p>(PS imo we need the <code>odp.net-core</code> tag)</p>
  
  <p><strong>UPDATE</strong></p>
  
  <ol>
  <li><p>One need to ensure the <code>w3wp.exe</code> can actually access the files.</p></li>
  <li><p>Setting system environment variable <code>TNS_ADMIN</code> is a possible solution. It'll suffice in this particular case, but I'm still curious about how to configure it via <code>web.config</code>.</p></li>
  </ol>