简体   繁体   English

使用ODP.NET 64位的.NET Web服务

[英].NET Webservice using ODP.NET 64bit

I created a web service in .net4.0. 我在.net4.0中创建了一个Web服务。 It connects to an oracle-database by ODP.NET4. 它通过ODP.NET4连接到oracle数据库。 FYI I used ODAC112021Xcopy_X64 and installed odp4 and asp4. 仅供参考,我使用了ODAC112021Xcopy_X64并安装了odp4和asp4。 The service runs well in development environment. 该服务在开发环境中运行良好。

But after publishing it to IIS running on the same machine I get the following exception: 但是将其发布到在同一台计算机上运行的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]

I use 64bit odp.net, I'm running on Windows Server 2008 R2 64bit and switched to 64bit in Visual Studio. 我使用64位odp.net,我在64位Windows Server 2008 R2上运行,并在Visual Studio中切换到64位。

Can anybody tell me what I'm missing or doing wrong? 谁能告诉我我缺少什么或做错了什么?

I also tried to copy the ORACLE.DATACCESS.dll to the bin folder. 我还尝试将ORACLE.DATACCESS.dll复制到bin文件夹。

Thanks in advance 提前致谢

检查编译器计算机(32/64位)中的ODAC目标平台是否与放置Web服务的生产服务器相同。

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. 由于无法重新创建问题,因此此操作是黑暗的,但是在IIS中运行时,您需要确保所使用的特定框架(这里为4.0)的信任级别可以访问适当的dll和文件。

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 您可以卸载/重新安装odp位,或直接在%ora_home \\ product \\ 11.2.0 \\ client_1 \\ odp.net \\ bin \\ 4 \\ OraProvCfg.exe中调用“ oracle权限”软件

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) 另外,请检查自述文件(特别是此部分):%ora_home \\ product \\ 11.2.0 \\ client_1 \\ odp.net \\ doc \\ readme.txt(这是我认为您可能感兴趣的简介)

==============================
ORACLEPERMISSION RELATED NOTES
==============================

1. Configuring OraclePermission for Web Applications in high or medium trust

For Web Applications operating under high or medium trust, OraclePermission 
needs to be configured in the appropriate "web_<trust level>.config"  file so 
that the application does not encounter any security errors.  This 
configuration can be done through the OracProvCfg tool. OraProvCfg.exe will
make the appropriate entries in both web_hightrust.config as well as 
web_mediumtrust.config associated with the specified .NET framework version. 

Given below is an example on the usage of OraProvCfg tool for configuring 
OraclePermission in a .NET 2.0 web application:

    OraProvCfg.exe /action:config  /product:odp /component:oraclepermission 
                   /frameworkversion:v4.0.30319
                   /providerpath:<Oracle.DataAccess.dll full path>

On running the above command, The following entry will be made in  
"web_hightrust.config" and  "web_mediumtrust.config" under ASP.NET permissionset

<IPermission class="Oracle.DataAccess.Client.OraclePermission, Oracle.DataAccess, Version=4.112.2.50, Culture=neutral, PublicKeyToken=89b483f429c47342" version="1" Unrestricted="true" />

OraProvCfg can also be used to remove these entries from these config files 
when they need to be removed.

    OraProvCfg.exe /action:unconfig  /product:odp  /component:oraclepermission
                   /frameworkversion:v4.0.30319
                   /providerpath:<Oracle.DataAccess.dll full path>


2. Configuring OraclePermission For Windows Applications in partial trust

For Windows applications operating in a partial trust environment, the 
OraclePermission entry should be specified under the appropriate permission 
set in security.config file. (Security.config is available in 
%windir%\Microsoft.NET\Framework\{version}\CONFIG). The example below 
specifies the OraclePermission entry that would be required for a .NET 2.0 
Windows application

<IPermission class="Oracle.DataAccess.Client.OraclePermission, Oracle.DataAccess, Version=4.112.2.50, Culture=neutral, PublicKeyToken=89b483f429c47342" version="1" Unrestricted="true" />

specifically check out those config files (" web_hightrust.config " and " web_mediumtrust.config ") search for a similar entry 专门检查那些配置文件(“ web_hightrust.config ”和“ web_mediumtrust.config ”),以搜索相似的条目

<IPermission class="Oracle.DataAccess.Client.OraclePermission,
Oracle.DataAccess, Version=4.112.2.50, Culture=neutral,
PublicKeyToken=89b483f429c47342" version="1" Unrestricted="true" />

(this readme is from the beta 3 for the EF so I would expect the version numbers to be different) (此自述文件来自EF的Beta 3,因此我希望版本号有所不同)

You can also look at this forum (it appears similar to this line of thought) https://forums.oracle.com/forums/thread.jspa?threadID=575320 您也可以查看此论坛(它看起来类似于此思路) https://forums.oracle.com/forums/thread.jspa?threadID=575320

hth hth

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM