I have an ASP.NET Core application running on .NET Core 3.1 in IIS 10 on Windows Server 2019. When trying to connect to an Oracle ODBC data source, I'm getting this error:
System.Data.Odbc.OdbcException (0x80131937): ERROR [IM003] Specified driver could not be loaded due to system error 1114: A dynamic link library (DLL) initialization routine failed. (Oracle in instantclient_12_2, C:\Oracle64\instantclient_12_2\SQORA32.dll).
at System.Data.Odbc.OdbcConnection.HandleError(...)
at System.Data.Odbc.OdbcConnectionHandle..ctor(...)
at System.Data.Odbc.OdbcConnectionOpen..ctor(...)
at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(...)
at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(...)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(...) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(...) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(...) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(...) at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(...) at System.Data.Odbc.OdbcConnection.Open()
On the server, I have the 64-bit Oracle ODBC driver (v12.2) installed, my DSN/connection is configured in the ODBC Data Sources (64-bit), and the Platform target for the ASP.NET Core app is "x64". My code boils down to this (with Dsn and Pwd sanitized):
using (var odbcConnection = new OdbcConnection("Dsn=PROD_US_64;Pwd=abcdefg"))
{
odbcConnection.Open();
}
And here's the crazy part. The exact same code works fine on that machine (and I am able to run queries and read data) as a ...
This suggests that the problem seems to be something specific to ASP.NET Core.
I believe my ODBC driver is installed and configured correctly, and I don't believe this is a bitness (32 vs 64) problem. When I have a bitness mismatch, I get a different error ("OdbcException: ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application").
I've tried:
Any other ideas at all? I've been at this for a full day now and am willing to try anything.
User contributions licensed under CC BY-SA 3.0