简体   繁体   中英

Oracle Data Access Dll is not working

I just reformatted my pc into Windows 7 64bits. I open my previous project (Always in ANY CPU) and run it, but I encountered this error

System.InvalidOperationException: 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. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

I have already installed Oracle Client win64_11gR2_client and it is in 64bits. Any Idea how to solve this issue?

Oracle.ODP has unmanaged code and requires the owning process to match the 'bitness'.

You need to ensure that when compiling your program as AnyCPU, that it runs in a 64-bit environment to match your 64-bit driver's bitness. You can check your TaskManager to see if your program has a * 32 next to the process name (Means the app runs in a 32 bit context).

The bitness mismatch usually happens when you're trying to debug an application with Visual Studio on a x-64 OS.

You can solve it by installing the x86 driver of Oracle.ODP .

If you are sure that you only need to support x64 bit environment, compile with as x64 instead of AnyCPU.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM