OracleException (0x80004005): The provider is not compatible with the version of Oracle client (提供程序与oracle客户端的版本不兼容)
或者
-
Could not load file or assembly ‘Oracle.DataAccess’ or one of its dependecies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).
-
The type initializer for ‘Oracle.DataAccess.Client.OracleCommand’ threw an exception.
-
[TypeInitializationException: The type initializer for ‘Oracle.DataAccess.Client.OracleConnection’ threw an exception.] (“Oracle.DataAccess.Client.OracleClientFactory”的类型初始值设定项引发异常)
1.Description(问题描述):
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
(执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息)
2.Exception Details(异常详细信息):
Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client.
(Oracle.DataAccess.客户端异常:提供程序与此版本的 Oracle 客户机不兼容)
3.Source Error(源文件错误点):
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
(在执行当前web请求期间生成了未处理的异常。有关异常的来源和位置的信息可以使用下面的异常堆栈跟踪来标识。)
4.Stack Trace(堆栈跟踪):
[OracleException (0x80004005): The provider is not compatible with the version of Oracle client]
'(提供程序与此版本的 Oracle 客户机不兼容)
Oracle.DataAccess.Client.OracleInit.Initialize() +381
Oracle.DataAccess.Client.OracleConnection..cctor() +828
[TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.]
'(“Oracle.DataAccess.Client.OracleClientFactory”的类型初始值设定项引发异常)
......
5.Solution:(解决方案):
- 造成此问题的原因:本机/程序引用的Oracle.DataAccess.dll版本与服务器的版本不匹配。
- 本机 / 程序引用: %ORACLE_Home%\odp.net\bin\4\Oracle.DataAccess.dll 的版本为4.112.3.0
- 服务器: %ORACLE_Home%\odp.net\bin\4\Oracle.DataAccess.dll 的版本为 4.122.19.1
Ps. %ORACLE_Home%: 表示Oracle的安装目录。
- 解决方法:
- 本机:重新安装对应版本的ODAC ;
- 程序引用:更换为服务器上对应的ODAC(
Oracle.DataAccess.dll),重新BuildandRelease程序。

遇到OracleException,提示提供程序与Oracle客户端版本不兼容。问题源于本地Oracle.DataAccess.dll版本与服务器版本不一致。解决方案包括:在本地重新安装对应版本的ODAC,或在程序中更换与服务器匹配的ODAC版本并重新编译。
862

被折叠的 条评论
为什么被折叠?



