BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed

后端 未结 21 2179
南方客
南方客 2020-11-21 13:30

I am getting this error while on of my .Net application are trying to make a connection to oracle database.

The error says that This problem will

21条回答
  •  感情败类
    2020-11-21 13:58

    I would like to add a resolution that worked for me. Setup: Oracle 11g 64 bits running on Windows 2008 R2 (64 bits OS)

    Client is a .net framework 3.5 application (ported from 2.0) compiled with x86 platform setting.

    I had the exact same issue of BadImageFormatException. Compiling to 64 bits eliminates the exception but it was not an option for me as my app is using 32 bits activex components who do not work in 64 bits.

    I solved the issue by downloading Oracle Instant Client 11 (this is just a bunch of DLL than can be xcopied) from Oracle website, and copying the files in my application files directory. See here : http://www.oracle.com/technetwork/database/features/oci/instant-client-wp-131479.pdf

    This has solved the issue, from ProcMon tool I can see that the locally copied oci.dll gets loaded by System.Data.OracleClient and everything is fine.

    It could probably be done by changing environment settings like proposed above, but this method has the advantage of not altering any settings on the server configuration.

提交回复
热议问题