Ned
Ned

Reputation: 1207

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

Upvotes: 5

Views: 507

Answers (2)

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).

Upvotes: 1

Littlefoot
Littlefoot

Reputation: 143013

You mean, " without installing Oracle 11g, don't you? 12c is installed right now. At least, that's what I understood - application runs OK on [Server 2008 + 11g], and now you want it to run on [Server 2016 + 12c].

If it turns out that I'm right and that you'd have to install 11g onto Server 2016, then you could install Oracle Client software, but - if you ask me - I'd rather install Oracle 11g Express Edition (XE) database. Here's why:

  • installation is easy (a few NEXT clicks)
    • just make sure to install it into its own Oracle Home (i.e. directory, one that is different from the one that contains 12c)
  • it won't take much space
  • set it (in "Services") to be started manually (i.e. never), as you don't really need to use it as a database, but only its DLLs or whatever your application needs, so it won't take any resources (but hard disk space)
  • it contains everything you might need (including utilities, such as export/import & SQL*Loader, network support)
  • whenever I needed something, I was much happier with XE installation than the Client installation (but OK, that's probably me, not being capable of using Client properly)

If it turns out that I'm wrong, oh well, wait for someone else's & far better opinion.

Upvotes: 0

Related Questions