The provider is not compatible with the version of Oracle client.提供程序与oracle客户端的版本不兼容

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

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),重新Build and Release程序。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值