我正在尝试将一个连接到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安装会这么难?我要解决什么问题?有没有人知道一篇博客文章可以展示如何正确设置它?我试着找了,但找不到任何东西,我相信我不是唯一有这个问题的人。
嗯,任何帮助都将不胜感激。非常感谢。
编辑
我回来尝试使用ODP.NET,因为在尝试使用Microsoft的OracleClient时出现了所有问题。我在开发机上安装了OPD.NET2 64位,在项目的参考文献中,我删除了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 ---