[UPDATE] How to fix System.Data.OracleClient BadImageFormatException error

In my previous post on how to fix System.Data.OracleClient BadImageFormatException error on 64-bit machine, I mentioned a quick way to fix the error by changing the application’s Target CPU to x86 in Visual Studio. It seems that it works on Windows XP x64 OS, but if you use Windows Vista or Windows 7 x64, the fix will not work and you will keep getting the same error. It seems that IIS 7 still runs in 64-bit mode even the application is compiled into 32-bit dll. So banging my head over the fall millions of times, I came to realize that the ultimate fix for this error is to use Oracle’s ODP.NET assembly (Oracle.DataAccess.dll), instead of using Microsoft’s System.Data.OracleClient.dll (it is 32-bit, and Microsoft will not continue the development of this dll, so there is no 64-bit version).

Download the latest Oracle ODAC: http://www.oracle.com/technetwork/developer-tools/visual-studio/downloads/index.html


Leave a Reply

Notify of
Close Bitnami banner