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.
When I deploy it to the windows server with IIS, I place a tnsnames.ora
file in app's directory and again it just works.
Now I want to use a shared tnsnames.ora
file. I have tried web.config
like following (recipy from StackOverflow/Google answers to similar questions).
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
</configSections>
<!-- skipping app stuff -->
<oracle.manageddataaccess.client>
<version number="*">
<settings>
<setting name="tns_admin" value="F:\path\to\tnsadmin\folder" />
</settings>
</version>
</oracle.manageddataaccess.client>
</configuration>
Unfortunately, this doesn't work (and since the Core version of Oracle.ManagedDataAccess.dll
doesn't have an ODPMSectionHandler
class it isn't a big surprise).
So, is there a way to have a shared tnsnames.ora
file with odp.net core?
(PS imo we need the odp.net-core
tag)
UPDATE
One need to ensure the
w3wp.exe
can actually access the files.Setting system environment variable
TNS_ADMIN
is a possible solution. It'll suffice in this particular case, but I'm still curious about how to configure it viaweb.config
.