Run Oracle Client in 32-bit mode on a 64-bit machine

I have just moved from a 32-bit Windows 7 desktop to a 64-bit Windows 7 Laptop. We have a C# program that we are developing that contains approximately 60 projects within the solution. I keep getting the following error whilst trying to build:

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

Obviously the error is quite self explanatory and I am trying to get my whole solution to load in 32 bit mode. I have gone through every single project and set the target platform to x86 but I am still getting this error. I have searched Google and seen countless different approaches, but I cant seem to fix this problem. What is the best way to ensure my project is running in 32-bit mode on a 64-bit machine?

I am using Visual Studio 2008. I am currently considering downgrading to 32-bit but really want to avoid having to do this.

Answers


I found that you have to install the 32-bit Oracle client (you can download the installer from their website) even if you are running on a 64-bit machine.

In addition, during the discussions people were talking about 32-bit mode etc. This is how you can check / set that for an IIS 7 hosted application. You shouldn't need to change this but I have added here for completeness / future reference.

  • Launch IIS 7 and expand the server name node.
  • Click on Application Pools node and find the application Pool you are using.
  • On the right-hand panel click Advanced Settings...
  • In the pop-up box that appears check Enabled 32-Bit Applications setting which is third option from the top.

You have to change your main .exe file to run only as 32-bit. You can do this in Visual Studio - just change Platform target from "Any CPU" to "x86".

If this is not possible, use corflags.exe which forces an existing exe to be a 32-bit application.


I have been struggling with this issue for months now and finally solved it. I think all the posts are helpful, but I had one missing piece. I didn't have a Microsoft ODBC for Oracle instance setup for User DSN or System DSN. I'm working on a Windows 8 machine. So for me I had to go to the general windows search and type in ODBC and open the ODBC Data Source Administrator (32-bit). Check to see if you have a Microsoft ODBC for Oracle setup on the User DSN tab or the System DSN tab. If not click on Add and select Microsoft ODBC for Oracle. Fill out the info for your datasource you are trying to hit and click ok. Make sure to restart your computer and that is what finally worked for me. Hope this helps some of you.


In my case 64 bit Oracle client was installed on my machine but still giving same error. So, I have analyse that in my application go to Application right click go to ->Properties->Web tab and uncheck the "Use IIS Express" option if you are using local IIS Web server. Problem got solved.


Need Your Help

F# break from while loop

f# while-loop break

There is any way to do it like C/C#?

Ending blocked GUI threads

java multithreading swing crash-reports

I am writing a platform game in java. I am making it so that when an exception occurs in the game it will show the user an error report. However, it is causing problems when an error occurs in a ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.