wcf - 在 Windows 2008 R2 64 位和 WCF 上运行 Oracle

标签 wcf oracle iis-7 64-bit windows-server-2008

我正在尝试将连接到 Oracle 10gR2 数据库的 WCF 4.0 服务部署到运行 AppFabric 的 Windows 2008 R2 64 位服务器。在我的 Windows 7 64 位系统上,在 Visual Studio 2010 中,一切顺利。 我首先开始使用 Oracle ODP.NET,在部署时,我开始得到:

System.IO.FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
File name: 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'

我尝试了很多东西,但似乎没有任何效果,因为我非常渴望让它工作,所以去了 OracleClient,尽管事实上它被标记为已弃用,只是为了让它工作,然后买给我时间。我删除了已安装的所有内容,但仅安装了带有运行时选项的 win64_11gR2_client.zip。然而,比我开始得到:

System.DllNotFoundException: Unable to load DLL 'oramts.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

因此,我重新安装了 win64_11gR2_client.zip,添加了 Oracle Services for Microsoft Transaction Server 组件。但是,每当我调用 WCF 服务时,IIS 就会崩溃并出现以下错误:

Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7afa2
Faulting module name: ntdll.dll, version: 6.1.7601.17514, time stamp: 0x4ce7c8f9
Exception code: 0xc0000374
Fault offset: 0x00000000000c40f2
Faulting process id: 0xb28
Faulting application start time: 0x01cc0b141a857fac
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 7630c4b0-7707-11e0-8419-00155d010609

如果我尝试更改 AppPool 以启用 32 位应用程序,则 WSDL 甚至不会生成,并且我会得到:

A process serving application pool 'MyAppPool' suffered a fatal communication error with the Windows Process Activation Service. The process id was '2856'. The data field contains the error number.

我迷失了,我不知道该怎么办。建立一个“简单”且典型的 Oracle 设置怎么会这么难呢?我要尝试解决什么问题?有谁知道有一篇博客文章可以展示如何正确设置它?我尝试寻找,但找不到任何东西,而且我确信我不是唯一有这个问题的人
嗯,任何帮助将非常感激。非常感谢

编辑

由于尝试使用 Microsoft 的 OracleClient 时出现了所有问题,我又尝试使用 ODP.NET。我在我的开发机器上安装了OPD.NET2 64位,在项目的Reference上,我删除了32位引用,并手动引用了64位Oracle.DataAccess.dll。每当我这样做时,我都无法在我的开发机器上使用该解决方案,因为我收到错误:

Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format

这可能是由于它尝试加载 32 位 ODAC,而不是 64 位 ODAC。但是,在部署到 64 位服务器后,我不再收到 FileNotFoundException,但开始收到:

System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client
   at Oracle.DataAccess.Client.OracleInit.Initialize()
   at Oracle.DataAccess.Client.OracleConnection..cctor()
   --- End of inner exception stack trace ---

最佳答案

I removed the 32-bit reference, and manually reference the 64-bits Oracle.DataAccess.dll. Whenever I do this, I'm unable to use the solution on my Dev Machine, since I get the error:

Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format

我在我的开发机器上遇到了同样的问题。我检查了 IIS 上的应用程序池设置,发现“启用 32 位应用程序”选项已设置为“True”。我只使用 64 位应用程序,因此将此选项设置为其默认值:“False”是安全的。之后一切对我来说都很好。

您可以在 IIS 7 管理器中更改此设置。右键单击应用程序池并选择“高级设置...”。它位于“(常规)”组中。

关于wcf - 在 Windows 2008 R2 64 位和 WCF 上运行 Oracle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5896906/

相关文章:

c# - 套接字与 Wcf 通信

oracle - 在PLSQL中如何获取发生异常的过程/函数名称?

iis-7 - 同一个IP的443端口中的多个域

c# - .Net Remoting 不使用.Net Remoting?

wcf - BasicHttpBinding 与 TransportWithMessageCredential 和 clientCredentialType ="Windows"

c# - ReaderWriterLock 在 ServiceBehavior 构造函数中不起作用

sql - pl/sql - 集合可以遍历列名吗?

oracle - ORA-00984 : column not allowed here

iis-7 - 阻止 IIS 7.5 将不存在的页面传递到 Coldfusion

iis-7 - IIS 7.0 - IIS 将 "private"添加到缓存控制,它来自哪里