Oracle data access version issue

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.

c#
asp.net
oracle
odp.net
asked on Stack Overflow Aug 3, 2015 by smilu

1 Answer

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.
answered on Stack Overflow Aug 3, 2015 by Patrick Hofman

User contributions licensed under CC BY-SA 3.0