2

I am connecting to oracle using ODP.NET. My testing server has two versions of Oracle(v4 and v2) installed. I have a third party application which is connected to one version(v4) and my application is connected to the other(v2).

When I run my application using a Visual studio, it works perfectly without any errors. But, when I publish and run from IIS it throws error saying

Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

If I place the Oracle dll with version 4.1 it will start to show a different error

Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.

How to fix this issue without removing(uninstalling) oracle from the machine?


NOTE: In current scenario, oracle versions cannot be removed from the server. So, both version will remain installed.

smilu
  • 809
  • 7
  • 28
  • 48
  • Have a look at this instruction [Install Oracle x86 and x64](http://stackoverflow.com/questions/659341/the-provider-is-not-compatible-with-the-version-of-oracle-client#25412992) how to install both 32 bit and 64 together on one machine. – Wernfried Domscheit Aug 03 '15 at 11:33
  • Did you do an install with the installer, or just copy dlls? For the unmanaged ODP.NET you should do a proper install since there are so many dependencies and moving parts. Did you install odp.net x64 if your app is 64 bit? When you install the correct version of ODP.NET on the server, give it its own Oracle Home (directory) to keep things clean. – Christian Shay Aug 03 '15 at 19:15
  • We installed using an installer. – smilu Aug 04 '15 at 07:00

1 Answers1

1

The first error message tells you didn't install the proper version of the Oracle Data client. It was looking for Oracle.DataAccess, Version=4.121.1.0 but it wasn't there.

The second error message tells you it is there now, but it tries to load a different architecture (that is: you installed 32-bit while the process is 64-bit or the other way around).

There are several fixes:

  1. Install the right version of the client tools, including the right 'bits' version.
  2. Set IIS to run in another bit mode (so revert to 32 bits if the process is 64 bits now).
  3. (Preferred) Use the architecture independent version of the Oracle data client: Oracle Managed.
Patrick Hofman
  • 143,714
  • 19
  • 222
  • 294