System.Data.OracleClient not working with 64 bit Oracle Client

21,635

Solution 1

First of all, provider System.Data.OracleClient is deprecated. Microsoft is not supporting it anymore, you should consider to use the Oracle provider Oracle.DataAccess or Oracle.ManagedDataAccess.

My recommondation is to install both, 32-bit and 64-bit Oracle Client on your developing machine, then you can test and build anything. Here is an instruction how to do this: Install x86 and x64 Oracle Client on one machine

An x86 Oracle client can connect to a 64 bit Oracle Database, vice versa is also no problem.

Solution 2

I had the same issue on a Windows 10 PC. I copied the project from my old computer to the new one, both 64 bits, and I installed the Oracle Client 64 bit on the new machine. I got the same error message, but after trying many solutions to no effect, what actually worked for me was this:

In your Visual Studio (mine is 2017) go to

Tools > Options > Projects and Solutions > Web Projects

On that page, check the option that says: Use the 64 bit version of IIS Express for Websites and Projects

Share:
21,635
jetty
Author by

jetty

Updated on July 29, 2022

Comments

  • jetty
    jetty almost 2 years

    I have designed a C# application to connect to Oracle Database and change schema users passwords. My reference assembly is System.Data.OracleClient from the location: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Data.OracleClient.dll"

    The platform that I used to design/test the application looks like this: 1. 64 bit Windows 7 platform. 2. 32 bit .Net Frameworkv4.5 3. 32 bit Oracle 10g Client.

    I need this application to run for 64 bit Oracle Client too. But when I transfer my binaries to a machine which has 64 bit Oracle 11g installed, I get this error: "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 am not sure how to work around this issue. Please suggest if I need to make any code changes or assembly reference. I read through a lot of similar forums but could not find anything helpful. Please help!