views:

363

answers:

2

I have been developing an ASP.NET application on Windows XP Professional. While promoting to production I have only now found out that the server is 64 bit. I installed Oracle Client 32 bit on the server and cannot connect to Oracle.

I am using the Microsoft Provider for Oracle, and my question is, how do I get an ASP.NET application compiled on a 32 bit machine to connect to Oracle on a Windows Server 2003 64 bit machine?

EDIT:

In response to a comment on my original question, the error I am getting is "Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed"

I have uninstalled the 32 bit client and am getting the 64 bit client installed, the problem is that the server is a production server in a DMZ and I have no access to the server myself, so I am trying to anticipate any problems I will have when the 64 bit client is installed and I try to access the ASP.NET application on the server

+1  A: 

Another thing to try would be to set the app pool hosting the application to 32-bit mode. http://extended64.com/blogs/rhoffman/archive/2005/05/10/482.aspx

This should allow a 32-bit driver to be loaded.

Kevin Dente
+1  A: 

Straightforward solution : you should install the Oracle client according to the platform (x64 on a x64 machine). The reason is that your .NET application is very likely to be built in AnyCPU configuration, which means it will run as a x64 application on a x64 platform. It then can only load x64 native libraries...

Note that when it comes to Oracle, I like to use Oracle Instant Client :

  • You don't have to install anything on the target machines (including dev boxes !).
  • You can make sure that your application will run with the specific client you picked (version, x86/x64).
  • You could even easily have multiple applications work with different client versions on the same computer.
  • As a downside, it adds a significant weight to your application (~19Mb minimum).

Check What is the minimum client footprint required to connect C# to an Oracle database? for more information.

In your particular case, I recommend setting up a Visual Studio project that will work on x86 as well as x64 machines : check my blog post Oracle Instant Client in Visual Studio. Then here is a guidance on how to configure a WiX package for Oracle Instant Client targeting x86 or x64 machines. If you use another deployment strategy, just make sure you ship the correct client according to the target platform.

Mac