Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to host an ASP.NET application that uses Oracle 11g on a machine that has only Oracle 12c?

My ASP.NET application runs on a Windows Server 2008 R2 server. Oracle 11g is installed.

I deployed this application to a Windows Server 2016 server. Oracle 12c is installed in this server (11g is not supported).

When I run the application, I get this error:

Could not load file or assembly Oracle.DataAccess

If I copy Oracle 11g dll (Oracle.DataAccess.dll) to application's bin folder, I see this message:

The provide is not compatible with the version of Oracle client

Is there any way to make this application run without installing Oracle 11g or changing application code?

enter image description here

like image 623
Ned Avatar asked Nov 07 '22 05:11

Ned


1 Answers

If i understand well your application is linked to 11gR2 dll of Oracle.DataAccess.dll.

Can you check the version of the dll that is in your path (probably in the GAC, but not always) ?

What do you have in this section of Web.config (sample taken from my web site) ? Does this match the dll in your path ? :

<runtime>
    <!-- This prevents the Windows Event Log from frequently logging that HMAC1 is being used (when the other party needs it). -->
    <legacyHMACWarning enabled="0" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Oracle -->
        <dependentAssembly>
            <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.65535.65535.65535" newVersion="4.122.1.0" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
            <bindingRedirect oldVersion="4.0.0.0 - 4.65535.65535.65535" newVersion="4.122.1.0" />
        </dependentAssembly>

Above I am remapping all versions of the driver to the driver installed on my server. It usually works fine, unless you are activelly using something that is only present in a "up" version.

Be sure to check the version of your dll (the version above is for a a 12.2 driver).

like image 68
Michel de Becdelièvre Avatar answered Nov 14 '22 22:11

Michel de Becdelièvre