2011-10-21 61 views
0

我在.net4.0中創建了一個Web服務。它通過ODP.NET4連接到一個oracle數據庫。 FYI我使用ODAC112021Xcopy_X64並安裝了odp4和asp4。該服務在開發環境中運行良好。使用ODP.NET 64位的.NET Web服務

但它發佈到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位運行,切換到64位視覺工作室。

有人可以告訴我我失蹤或做錯了什麼嗎?

我也嘗試將ORACLE.DATACCESS.dll複製到bin文件夾中。

在此先感謝

回答

0

這是一個在黑暗中拍攝,因爲我無法重現該問題,但在IIS中運行時,你需要確保的具體框架信任級別(在此爲4.0)你是使用可以訪問適當的dll和文件。

您可以卸載/重裝ODP位,或直接 致電 %ORA_HOME \產品 '甲骨文許可' 軟件\ 11.2.0 \ Client_1與\ odp.net \ BIN \ 4 \ OraProvCfg.exe

此外,檢查出的自述(特別是這部分): %ORA_HOME \產品\ 11.2.0 \ Client_1與\ odp.net \ DOC \ readme.txt文件 (這裏,我認爲可能是您感興趣的Blurb的)

============================== 
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" /> 

明確檢查出這些配置文件(「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" /> 

(本自述是從公測3爲EF,所以我期望的版本號是不同的)

您也可以看看這個論壇(它會出現類似於這樣的思路) https://forums.oracle.com/forums/thread.jspa?threadID=575320

心連心

0

檢查Ø編譯器中的DAC目標平臺(32/64位)與放置Web服務的生產服務器相同。