Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Oracle on Windows 2008 R2 64-bits and WCF

I'm trying to deploy to a Windows 2008 R2 64-Bits server running AppFabric a WCF 4.0 service that connects to an Oracle 10gR2 database. On my Windows 7 64-Bits, inside Visual Studio 2010, everything goes well. I first started using Oracle ODP.NET and, on deploy, I started getting the:

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'

I tried so many things, and nothing seemed to work, and since I'm kinna desperate to get this working, and went to OracleClient, despite the fact that it's marked as deprecated, just to get this working, and buy me time. I removed everything I had installed, but installed just the win64_11gR2_client.zip, with the runtime option. However, than I started getting:

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

So I reinstalled the win64_11gR2_client.zip, adding the Oracle Services for Microsoft Transaction Server component. But then, whenever I made a call to my WCF service, IIS would crash with the error below:

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

If I tried to change the AppPool to enable 32-bits application, the WSDL doesn't even get generated, and I get the:

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.

I'm lost, and I don't know what to do. How can it be this hard to do a "simple" and typical Oracle set up? What problem would I try to solve? Does anyone know of a blog post that would show how to correctly set this up? I tried looking, but coudln't find anything, and I'm sure I'm not the only one with this problem
Well, any help would be really appreciated. Tks so much

EDIT

I'm back trying to use the ODP.NET, since of all the problems that came up trying to use Microsoft's OracleClient. I installed OPD.NET2 64 bit on my development machine, on the project's Reference, 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

This is probably due to the fact that it tries to load the 32-bit ODAC, instead of the 64-bit one. But, after I deploy to my 64-bit server, I stop getting the FileNotFoundException, but I start getting:

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 ---
like image 774
Pascal Avatar asked Dec 13 '22 13:12

Pascal


1 Answers

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

I had the same issue on my dev-machine. I checked application pool's settings on IIS and it turned out that "Enable 32-Bit Applications" option had been set to "True". I work on 64-bit applications only, so it was safe for me to set this option to its default value: "False". After that all works fine for me.

You can change this setting in IIS 7 Manager. Right click on the application pool and select "Advanced Settings...". It's in "(General)" group.

like image 91
foka Avatar answered Dec 17 '22 12:12

foka