Oracle data access version issue

冷暖自知 提交于 2019-12-11 00:25:42

问题


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.


回答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.


来源:https://stackoverflow.com/questions/31783954/oracle-data-access-version-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!