在服务器上安装 ODP.net 以解决 Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8314038/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 16:03:41  来源:igfitidea点击:

Installing ODP.net on server to resolve Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client

.netoracle11goracleclient

提问by SoftwareSavant

I have a test environment for a service that my site will be using and a production environment. In my test environment I have ODP.net installed on the server. That service that uses Oracle seems to be running pretty smoothely so far. I don't appear to have an Oracle Client running on that server at all. On the other hand I have a server which has an Oracle client on it, but doesn't appear to have ODP.net installed on it (I am in the process of double checking, but that is the situation as of this S-O question). On the production server I get this exception:

我有我的站点将使用的服务的测试环境和生产环境。在我的测试环境中,我在服务器上安装了 ODP.net。到目前为止,使用 Oracle 的服务似乎运行得非常顺利。我似乎根本没有在该服务器上运行 Oracle 客户端。另一方面,我有一个服务器,上面有一个 Oracle 客户端,但似乎没有安装 ODP.net(我正在仔细检查,但这就是这个 SO 问题的情况) . 在生产服务器上,我收到此异常:

Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client

in both servers I have the Oracle.DataAccess dll in the bin and lib folders (don't think I need it in the lib folder, but why rock the boat... I am sure you can come up with a good reason, but not right now!!!). My question is do I need to install ODP.net onto the production server? Has that resolved any issues that you have come across? I have seen some SO post that say this resolved a similar issue for them. Could you recommend a course of action? Thank you!

在两台服务器中,我的 bin 和 lib 文件夹中都有 Oracle.DataAccess dll(不认为我需要在 lib 文件夹中使用它,但为什么要动摇船......我相信你可以想出一个很好的理由,但是不是现在!!!)。我的问题是我需要在生产服务器上安装 ODP.net 吗?这是否解决了您遇到的任何问题?我看到一些 SO 帖子说这为他们解决了类似的问题。你能推荐一个行动方案吗?谢谢!

回答by CodingWithSpike

There are a lot of little sub versions of the oracle client, and what likely happened is that the oracle clients installed on the machine giving the error isn't exactly the same version that the Oracle.DataAccess.dllfile came from.

oracle 客户端有很多小的子版本,可能发生的情况是安装在出现错误的机器上的 oracle 客户端与Oracle.DataAccess.dll文件来自的版本不完全相同。

The best thing to do is make sure you use exactlythe same install package on every dev machine and server. This will avoid any missmatch.

最好的办法是确保在每台开发机器和服务器上使用完全相同的安装包。这将避免任何错配。

As an alternative, what I've done in the past to resolve this (and it may not be the "best" thing to do, but it usually works for me) is to alsocopy the file OraOps11.dllto your \bindirectory, along with the Oracle.DataAccess.dllfile.

作为替代方案,我过去为解决此问题所做的工作(这可能不是“最好”的做法,但通常对我有用)也是将文件与文件一起复制OraOps11.dll到您的\bin目录中Oracle.DataAccess.dll.

Get the file from the same oracle install on the same machine where you got Oracle.DataAccess.dll. It should be in a folder named something like this, depending on where you installed Oracle, and what version:

从在您获得Oracle.DataAccess.dll. 它应该在一个类似这样命名的文件夹中,具体取决于您安装 Oracle 的位置和版本:

C:\oracle\product\11.1.0\client_1\bin\OraOps11.dll

C:\oracle\product\11.1.0\client_1\bin\OraOps11.dll

回答by Elie

This worked for me once i ran them:

一旦我运行它们,这对我有用:

OraProvCfg /action:config /product:odp /frameworkversion:v2.0.50727 /providerpath:C:\app\Administrator\product.2.0\client_1\ODP.NET\bin.x\Oracle.DataAccess.dll

OraProvCfg /action:config /product:odp /frameworkversion:v4.0.30319 /providerpath:C:\app\Administrator\product.2.0\client_1\ODP.NET\bin\Oracle.DataAccess.dll

Good luck

祝你好运

回答by Abdallah

I faced exactly the same problem, I tried to copy as much dlls as I can but without any luck.

我遇到了完全相同的问题,我试图复制尽可能多的 dll,但没有任何运气。

At the end I had to install "ODTwithODAC121012"(32bit) in the server(Win 2008 R2 64bit).

最后我不得不在服务器(Win 2008 R2 64bit)中安装“ODTwithODAC121012”(32位)。

After installation make sure:

安装后确保:

  • PATH is updated with Oracle dlls location: \product\12.1.0\client_1\bin and \product\12.1.0\client_1
  • Restart the server.
  • Enable 32bit for the App Pool in IIS.
  • PATH 使用 Oracle dll 位置更新:\product\12.1.0\client_1\bin 和 \product\12.1.0\client_1
  • 重新启动服务器。
  • 为 IIS 中的应用程序池启用 32 位。

回答by Fernando

I run with the same problem in a Windows 2012 Server that i had Installed Oracle 10.2.0.3 (the supossed oracle 10.2 version compatible with 64 bits) and deployed a web site that used 10.2.0.1 Oracle client.

我在安装了 Oracle 10.2.0.3(与 64 位兼容的 supossed oracle 10.2 版本)并部署了一个使用 10.2.0.1 Oracle 客户端的网站的 Windows 2012 服务器中遇到了同样的问题。

I tried all solutions in this post but the one that worked form my was the last point of Abdallah answer:

我在这篇文章中尝试了所有解决方案,但我的解决方案是 Abdallah 回答的最后一点:

"Enable 32bit for the App Pool in IIS"

“在 IIS 中为应用程序池启用 32 位”

Of course I also had to deploy my webapp with the correct Oracle.Data.Access reference (10.2.0.3)

当然,我还必须使用正确的 Oracle.Data.Access 参考 (10.2.0.3) 部署我的 webapp

Finally the error message was confusing me because it drived me to be blinded to resolve the version issue, but the really problem was IIS not being capable to excute 32 bits App.

最后,错误消息让我感到困惑,因为它使我无法解决版本问题,但真正的问题是 IIS 无法执行 32 位应用程序。

Hope it helps

希望能帮助到你

回答by Kishore

Thanks... this helped me saved time on converting frm 32 bit to 64 bit of our ASP.Net Application...

谢谢...这帮助我节省了将 ASP.Net 应用程序的 32 位转换为 64 位的时间...

In Details: APP server looking for client libraries, even we use remoting component to connect to ORACLE db... with ORACLE client 64 bit..

详细信息:APP服务器寻找客户端库,即使我们使用远程组件连接到ORACLE db...与ORACLE客户端64位..

Execption I got was resolved after copying these 5 dll's into my app/bin folder

将这 5 个 dll 复制到我的 app/bin 文件夹后,我得到的执行得到解决

  1. oci.dll
  2. oraociicu11.dll
  3. oraops11w.dll
  4. orannzsbb11.dll
  5. ociw32.dll
  1. oci.dll
  2. oraociicu11.dll
  3. oraops11w.dll
  4. orannzsbb11.dll
  5. ociw32.dll

Error Message: The type initializer for 'Oracle.DataAccess.Types.OracleString' threw an exception.

Error Details: System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Types.OracleString' threw an exception. ---> Oracle.DataAccess.Client.OracleException The provider is not compatible with the version of Oracle client at Oracle.DataAccess.Client.OracleInit.Initialize() --- End of inner exception stack trace ---

Server stack trace: at System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(ParseRecord pr) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseMember(ParseRecord pr) at System.Runtime.Serialization.Formatters.Binary._BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record) at System.Runtime.Serialization.Formatters.Binary._BinaryParser.Run() at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage) at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

错误消息:“Oracle.DataAccess.Types.OracleString”的类型初始值设定项引发异常。

错误详细信息:System.TypeInitializationException:“Oracle.DataAccess.Types.OracleString”的类型初始值设定项引发异常。---> Oracle.DataAccess.Client.OracleException 提供程序与 Oracle.DataAccess.Client.OracleInit.Initialize() 处的 Oracle 客户端版本不兼容 --- 内部异常堆栈跟踪结束 ---

服务器堆栈跟踪:在 System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(ParseRecord pr) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseMember (ParseRecord pr) 在 System.Runtime.Serialization.Formatters.Binary._ BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped 记录) 在 System.Runtime.Serialization.Formatters.Binary。_BinaryParser.Run() 在 System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) 在 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage) at System.Runtime.Remoting.Channels .BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)