使用 ODP.NET 64 位的 .NET Web 服务
我在.net4.0中创建了一个Web服务。它通过 ODP.NET4 连接到 oracle 数据库。仅供参考,我使用了 ODAC112021Xcopy_X64 并安装了 odp4 和 asp4。该服务在开发环境中运行良好。
但将其发布到在同一台计算机上运行的 IIS 后,出现以下异常:
System.ServiceModel.FaultException`1 was unhandled Message=Could not load file or assembly 'Oracle.DataAccess, Version=2.112.2.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) Source=mscorlib StackTrace: Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]
我使用 64 位 odp.net,我在 Windows Server 2008 R2 64 位上运行,并在 Visual Studio 中切换到 64 位。
谁能告诉我我错过了什么或做错了什么?
我还尝试将 ORACLE.DATACCESS.dll 复制到 bin 文件夹。
提前致谢
I created a web service in .net4.0. It connects to an oracle-database by ODP.NET4. FYI I used ODAC112021Xcopy_X64 and installed odp4 and asp4. The service runs well in development environment.
But after publishing it to IIS running on the same machine I get the following exception:
System.ServiceModel.FaultException`1 was unhandled Message=Could not load file or assembly 'Oracle.DataAccess, Version=2.112.2.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) Source=mscorlib StackTrace: Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]
I use 64bit odp.net, I'm running on Windows Server 2008 R2 64bit and switched to 64bit in Visual Studio.
Can anybody tell me what I'm missing or doing wrong?
I also tried to copy the ORACLE.DATACCESS.dll
to the bin folder.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个盲目的尝试,因为我无法重现该问题,但是在 IIS 中运行时,您需要确保您正在使用的特定框架(此处为 4.0)的信任级别可以访问适当的 dll 和文件。
您可以卸载/重新安装 odp 位,或者
直接调用“oracle权限”软件
%ora_home\product\11.2.0\client_1\odp.net\bin\4\OraProvCfg.exe
另外,请查看自述文件(特别是这部分):
%ora_home\product\11.2.0\client_1\odp.net\doc\readme.txt
(这是我认为您可能感兴趣的简介)
专门检查这些配置文件(“web_hightrust.config”和“web_mediumtrust.config”)搜索类似的条目
(此自述文件来自 EF 的 beta 3,所以我希望版本号有所不同)
您也可以查看此论坛(它看起来与此思路类似)
https://forums.oracle.com/forums/thread.jspa?threadID=575320
This is a shot in the dark since I cannot recreate the issue, but when running in IIS you need to make sure that the trust levels for the specific framework (herein being 4.0) you are using can access the appropriate dlls and files.
you can either uninstall/reinstall the odp bit, or
directly call the 'oracle permission' software at
%ora_home\product\11.2.0\client_1\odp.net\bin\4\OraProvCfg.exe
Also, check out the readme (specifically this part):
%ora_home\product\11.2.0\client_1\odp.net\doc\readme.txt
(here's the blurb that I think may be of interest to you)
specifically check out those config files ("web_hightrust.config" and "web_mediumtrust.config") search for a similar entry
(this readme is from the beta 3 for the EF so I would expect the version numbers to be different)
You can also look at this forum (it appears similar to this line of thought)
https://forums.oracle.com/forums/thread.jspa?threadID=575320
hth
检查编译器计算机(32/64 位)中的 ODAC 目标平台是否与放置 Web 服务的生产服务器相同。
Check if ODAC target platform in your compiler machine (32/64 bit) is the same of production server where you put your web services.