使用ODP.NET x64的x64中的WcfService失败(.NET 4.5和4.0)

时间:2014-04-01 07:04:20

标签: 64-bit windows-8.1 odp.net iis-8

我有Windows 8.1 64位,VS 2012 32位,IIS 8.5,IIS Express 32位。

WcfService项目目标框架:.NET 4.5 - ImageRuntimeVersion:v4.0.30319

IIS 8.5中托管的服务.NET 4.5 - >引用Oracle.DataAccess.dll ProcessorArchitecture:Amd64版本:4.121.1.0

ERROR执行OracleConnection.Open

Oracle.DataAccess.Client.OracleException     at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable)
   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
   at Oracle.DataAccess.Client.OracleConnection.Open()

使用带有x64的AnyCpu和WcfService项目的WcfService项目出错 我也在oracle.dataaccess.client部分使用DllPath测试,我得到了同样的错误

现在在IISExpress(x86)中托管的相同服务NET 4.5 - >引用Oracle.DataAccess.dll ProcessorArchitecture:X86版本:4.121.1.0 确定执行OracleConnection.Open

任何建议,如何调试或获取有关ODP.NET的日志,并获得解决方案?有可能吗?

我使用Target Framework再次测试:.NET 4.0,我得到了相同的错误(CLR 4.0 - v4.0.30319与.NET 4.0和4.5相同)

我也使用DllPath测试,但错误。

  <oracle.dataaccess.client>
    <settings>

      <!-- For X64 -->
      <!--<add name="DllPath" value="C:\app\Company\product\12.1.0\client_1\bin"  />-->

      <!-- For X86 -->
      <!--<add name="DllPath" value="C:\app\Company\product\12.1.0\client_2\bin"  />-->

    </settings>
  </oracle.dataaccess.client>

完整日志

Test Name: Obtener_datos_de_OdpNet_con_servicio_AnyCPU_hosted_en_IIS

ERROR select sysdate from dual


Oracle.DataAccess.Client.OracleException     at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable)
   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
   at Oracle.DataAccess.Client.OracleConnection.Open()




*** LOG ***


Environment Data:
ProcessName: w3wp
Is64BitOperatingSystem: True
Is64BitProcess: True
SystemConfigurationFile: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config
ConfigurationFile: C:\TFS\Main\MyCompany.Lite.Frk\Net4.0\Tests\Apps\WcfService\web.config
MainModule.FileName: c:\windows\system32\inetsrv\w3wp.exe
MainModule.ModuleName: w3wp.exe
BaseDirectory: C:\TFS\Main\MyCompany.Lite.Frk\Net4.0\Tests\Apps\WcfService\
ApplicationBase: C:\TFS\Main\MyCompany.Lite.Frk\Net4.0\Tests\Apps\WcfService\
FriendlyName: /LM/W3SVC/2/ROOT-2-130404614116233936
ApplicationName: c36153ea

Assembly Data:
Location: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\2090c609\c36153ea\assembly\dl3\92d3ec19\79a8efa4_4d4acf01\MyCompany.Lite.Frk.Data.Tests.WcfServiceLibrary.dll
ProcessorArchitecture: MSIL
Referenced Assemblies of MyCompany.Lite.Frk.Data.Tests.WcfServiceLibrary
          mscorlib - None      Location C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll - Amd64
          System - None        Location C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll - MSIL
          System.Core - None        Location C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll - MSIL
          Oracle.DataAccess - None       Location C:\Windows\Microsoft.Net\assembly\GAC_64\Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342\Oracle.DataAccess.dll - Amd64
          System.Data - None        Location C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll - Amd64
          System.ServiceModel - None     Location C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll - MSIL
          MyCompany.Lite.Data - None         Location C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\2090c609\c36153ea\assembly\dl3\08991152\90904b1f_c349cf01\MyCompany.Lite.Data.dll - MSIL
          Microsoft.Practices.EnterpriseLibrary.Data - None        Location C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\2090c609\c36153ea\assembly\dl3\261813e9\c453c0e2_d648cf01\Microsoft.Practices.EnterpriseLibrary.Data.dll - MSIL
          System.Runtime.Serialization - None       Location C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll - MSIL

Oracle.DataAccess Data:
Assembly: Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
AssemblyQualifiedName: Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
Module.FullyQualifiedName: C:\Windows\Microsoft.Net\assembly\GAC_64\Oracle.DataAccess\v4.0_4.121.1.0__89b483f429c47342\Oracle.DataAccess.dll
Location: C:\Windows\Microsoft.Net\assembly\GAC_64\Oracle.DataAccess\v4.0_4.121.1.0__89b483f429c47342\Oracle.DataAccess.dll
ProcessorArchitecture: Amd64
Version: 4.121.1.0
FullName: Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
GlobalAssemblyCache: True


PortableExecutableKinds: ILOnly, PE32Plus
ImageFileMachine: AMD64


Creating connnection using Oracle.DataAccess.Client.OracleConnection to MyCompany.ConnectionStrings.Oracle.MYSCHEMA
Connnection False
TestOdpNetConnection using Oracle.DataAccess. Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SERVERDB)(PORT=1523))(CONNECT_DATA=(SID=oas1d)));User Id=XXXXX;Password=XXXXX;
Oracle.DataAccess. Abriendo conexión a Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SERVERDB)(PORT=1523))(CONNECT_DATA=(SID=oas1d)));User Id=XXXXX;Password=XXXXX;
TestOdpNetConnection. Error en la conexión.


Msg: Oracle.DataAccess.Client.OracleException     at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable)
   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
   at Oracle.DataAccess.Client.OracleConnection.Open()
   at MyCompany.SourceRepository.OdpNetHelper.TestOdpNetConnection(String connectionString, String& trace) in c:\TFS\Main\MyCompany.Lite.Frk\Net4.0\Tests\Apps\WcfServiceLibrary\Common\OdpNetHelper.cs:line 60


Creating connnection using OdpNetDataContext to MyCompany.ConnectionStrings.Oracle.MYSCHEMA
ConnectionString: DATA SOURCE=MyDataSource;PASSWORD=XXXX;PERSIST SECURITY INFO=True;USER ID=MYSCHEMA
Database: data source=MyDataSource;persist security info=true;
DbProviderFactory: Oracle.DataAccess.Client.OracleClientFactory


Executing ExecuteNonQuery


Test Name: Obtener_datos_de_OdpNet_con_servicio_AnyCPU
Test Outcome:   Passed
Result StandardOutput:   
TestContext Messages:
Result:
OK

*** LOG ***
Environment Data:
ProcessName: iisexpress
Is64BitOperatingSystem: True
Is64BitProcess: False
SystemConfigurationFile: C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config
ConfigurationFile: C:\TFS\Main\MyCompany.Lite.Frk\Net4.0\Tests\Apps\WcfService\web.config
MainModule.FileName: C:\Program Files (x86)\IIS Express\iisexpress.exe
MainModule.ModuleName: iisexpress.exe
BaseDirectory: C:\TFS\Main\MyCompany.Lite.Frk\Net4.0\Tests\Apps\WcfService\
ApplicationBase: C:\TFS\Main\MyCompany.Lite.Frk\Net4.0\Tests\Apps\WcfService\
FriendlyName: /LM/W3SVC/3/ROOT-5-130404614413883655
ApplicationName: 6e9d8358


Assembly Data:
Location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9aada5e4\6e9d8358\assembly\dl3\12388fd2\79a8efa4_4d4acf01\MyCompany.Lite.Frk.Data.Tests.WcfServiceLibrary.dll
ProcessorArchitecture: MSIL
Referenced Assemblies of MyCompany.Lite.Frk.Data.Tests.WcfServiceLibrary
          mscorlib - None      Location C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll - X86
          System - None        Location C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll - MSIL
          System.Core - None        Location C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll - MSIL
          Oracle.DataAccess - None       Location C:\Windows\Microsoft.Net\assembly\GAC_32\Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342\Oracle.DataAccess.dll - X86
          System.Data - None        Location C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll - X86
          System.ServiceModel - None     Location C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll - MSIL
          MyCompany.Lite.Data - None         Location C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9aada5e4\6e9d8358\assembly\dl3\7ec82898\90904b1f_c349cf01\MyCompany.Lite.Data.dll - MSIL
          Microsoft.Practices.EnterpriseLibrary.Data - None        Location C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9aada5e4\6e9d8358\assembly\dl3\f06f5054\c453c0e2_d648cf01\Microsoft.Practices.EnterpriseLibrary.Data.dll - MSIL
          System.Runtime.Serialization - None       Location C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll - MSIL


Oracle.DataAccess Data:
Assembly: Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
AssemblyQualifiedName: Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
Module.FullyQualifiedName: C:\Windows\Microsoft.Net\assembly\GAC_32\Oracle.DataAccess\v4.0_4.121.1.0__89b483f429c47342\Oracle.DataAccess.dll
Location: C:\Windows\Microsoft.Net\assembly\GAC_32\Oracle.DataAccess\v4.0_4.121.1.0__89b483f429c47342\Oracle.DataAccess.dll
ProcessorArchitecture: X86
Version: 4.121.1.0
FullName: Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
GlobalAssemblyCache: True

PortableExecutableKinds: ILOnly, Required32Bit
ImageFileMachine: I386


Creating connnection using Oracle.DataAccess.Client.OracleConnection to MyCompany.ConnectionStrings.Oracle.MYSCHEMA
Connnection True
TestOdpNetConnection using Oracle.DataAccess. Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SERVERDB)(PORT=1523))(CONNECT_DATA=(SID=oas1d)));User Id=XXXXX;Password=XXXXX;
Oracle.DataAccess. Abriendo conexión a Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SERVERDB)(PORT=1523))(CONNECT_DATA=(SID=oas1d)));User Id=XXXXX;Password=XXXXX;
Oracle.DataAccess.OracleConnection State:  Open
Oracle.DataAccess.OracleConnection ServerVersion:  11.2.0.3.0
Oracle.DataAccess.OracleConnection DataSource:  (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SERVERDB)(PORT=1523))(CONNECT_DATA=(SID=oas1d)))
Oracle.DataAccess.OracleConnection ServiceName:  sys$users
Oracle.DataAccess.OracleConnection InstanceName:  oas1d
Oracle.DataAccess.OracleConnection HostName:  SERVERDB
Oracle.DataAccess.OracleConnection DatabaseName:  oas1d
Oracle.DataAccess.OracleConnection DatabaseDomainName:  null
Conectado True y cerrando conexión


Creating connnection using OdpNetDataContext to MyCompany.ConnectionStrings.Oracle.MYSCHEMA
ConnectionString: DATA SOURCE=MyDataSource;PASSWORD=xxxxxx;PERSIST SECURITY INFO=True;USER ID=MYSCHEMA
Database: data source=MyDataSource;persist security info=true;
DbProviderFactory: Oracle.DataAccess.Client.OracleClientFactory


Executing ExecuteNonQuery
Result: -1 para select sysdate from dual

我的环境:

我使用Windows 8.1 64位。 我使用VS 2012 Ultimate 32bit 我安装了:

64-bit ODAC 11.2 Release 3 (11.2.0.2.1) Xcopy for Windows x64
Location: C:\app\Company\odp.net\bin\2.x\Oracle.DataAccess.dll - ProcessorArchitecture: Amd64
Location: C:\app\Company\odp.net\bin\4\Oracle.DataAccess.dll - ProcessorArchitecture: Amd64

ODAC 11.2 Release 3 (11.2.0.2.1)
Location: C:\app\Company\product\11.2.0\client_2\odp.net\bin\2.x\Oracle.DataAccess.dll - ProcessorArchitecture: X86
Location: C:\app\Company\product\11.2.0\client_2\odp.net\bin\4\Oracle.DataAccess.dll - ProcessorArchitecture: X86

64-bit ODAC 12c Release 2 (12.1.0.1.2) for Windows x64
Location: C:\app\Company\product\12.1.0\client_1\odp.net\bin\2.x\Oracle.DataAccess.dll - ProcessorArchitecture: Amd64
Location: C:\app\Company\product\12.1.0\client_1\odp.net\bin\4\Oracle.DataAccess.dll  - ProcessorArchitecture: Amd64

ODAC 12c Release 2 (12.1.0.1.2) and Oracle Developer Tools for Visual Studio
Location: C:\app\Company\product\12.1.0\client_2\odp.net\bin\2.x\Oracle.DataAccess.dll - ProcessorArchitecture: X86
Location: C:\app\Company\product\12.1.0\client_2\odp.net\bin\4\Oracle.DataAccess.dll - ProcessorArchitecture: X86

此路径中的TNSNames.ora:

C:\app\Company\Network\Admin
C:\app\Company\product\11.2.0\client_2\Network\Admin

C:\app\Company\product\12.1.0\client_1\Network\Admin
C:\app\Company\product\12.1.0\client_2\Network\Admin

在GAC中,我有所有这些参考资料:

Oracle.DataAccess 32bit - 2.112.2.0 - CLR 2.0
Oracle.DataAccess 32bit - 2.121.1.0 - CLR 2.0

Oracle.DataAccess 64bit - 2.112.2.0 - CLR 2.0
Oracle.DataAccess 64bit - 2.121.1.0 - CLR 2.0

Oracle.DataAccess 32bit - 4.112.2.0 - CLR 4.0
Oracle.DataAccess 32bit - 4.121.1.0 - CLR 4.0

Oracle.DataAccess 64bit - 4.112.2.0 - CLR 4.0
Oracle.DataAccess 64bit - 4.121.1.0 - CLR 4.0

Oracle.ManagedDataAccess    MSIL  - 4.212.1.0 - CLR 4.0
Oracle.ManagedDataAccessDTC 32bit - 4.212.1.0 - CLR 4.0
Oracle.ManagedDataAccessDTC 64bit - 4.212.1.0 - CLR 4.0

添加了:

对于Tests.WcfServiceLibrary.csproj,我添加了对Oracle.DataAccess x86的引用。

Tests.WcfServiceLibrary.csproj是共享的,它用于IIS站点x64和IISExpress站点x86。

无论如何,在执行时间,它是从GAC加载的x64。查看日志:

*** LOG ***
ProcessName: w3wp
Is64BitOperatingSystem: True
Is64BitProcess: True

Assembly Data:
Location: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\2090c609\c36153ea\assembly\dl3\92d3ec19\fd0dc189_ea4ccf01\Tests.WcfServiceLibrary.dll
ProcessorArchitecture: MSIL
TargetFramework: .NET Framework 4.5
FullName: Tests.WcfServiceLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Referenced Assemblies of Tests.WcfServiceLibrary
                               Oracle.DataAccess - None                          Location C:\Windows\Microsoft.Net\assembly\GAC_64\Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342\Oracle.DataAccess.dll - Amd64

我在代码中得到了这个:

var t = typeof(Oracle.DataAccess.Client.OracleConnection);
var assembly = t.Assembly;
var asmName = AssemblyName.GetAssemblyName(assembly.Location);

和Oracle.DataAccess数据的日志:

Assembly: Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
AssemblyQualifiedName: Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
Module.FullyQualifiedName: C:\Windows\Microsoft.Net\assembly\GAC_64\Oracle.DataAccess\v4.0_4.121.1.0__89b483f429c47342\Oracle.DataAccess.dll
Location: C:\Windows\Microsoft.Net\assembly\GAC_64\Oracle.DataAccess\v4.0_4.121.1.0__89b483f429c47342\Oracle.DataAccess.dll
ProcessorArchitecture: Amd64
Version: 4.121.1.0
FullName: Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
GlobalAssemblyCache: True

OracleException.get_Number 给了我错误:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Oracle.DataAccess.Client.OracleException.get_Number()
   at SourceRepository.OdpNetHelper.TestOdpNetConnection(String connectionString, String& trace) in c:\TFS\0.SourceRepository\OdpNet\OdpNetHelper.cs:line 108

无论如何,我收到错误:

Msg: Oracle.DataAccess.Client.OracleException     at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable)
   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
   at Oracle.DataAccess.Client.OracleConnection.Open()
   at SourceRepository.OdpNetHelper.TestOdpNetConnection(String connectionString, String& trace) in c:\TFS\0.SourceRepository\OdpNet\OdpNetHelper.cs:line 61

OracleException。

Message: 
Error Code: -2147467259
HResult: -2147467259
Errors: 0

但没有错误代码

0 个答案:

没有答案