.NET Webservice using 64-bit ODP.NET

I created a web service in .net4.0. It connects to the ODP.NET4 Oracle database. FYI I used ODAC112021Xcopy_X64 and installed odp4 and asp4. The service works well in a development environment.

But after publishing to IIS running on the same computer, 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 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 am using 64-bit odp.net, I am running on Windows Server 2008 R2 64 bit and have switched to 64 bit in Visual Studio.

- , - ?

ORACLE.DATACCESS.dll bin.

0
2

, , IIS , ( 4.0), , DLL .

/ odp, % Ora_home\\11.2.0\client_1\odp.net\Bin\4\OraProvCfg.exe

, readme ( , ): % Ora_home\\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" />

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

( readme -3 EF, , )

(, ) https://forums.oracle.com/forums/thread.jspa?threadID=575320

HTH

0

, ODAC - (32/64 ) , -.

0

All Articles