C#连接Oracle时错误解决:Attempt to load Oracle client libraries threw BadImageFormatExce

c#通过oracle client连接oracle时报错如下:

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.

用c#的System.Data.OracleClient连接库时 可能的原因分析:

 1. Oracle client的位数为64位:

     1)c#应用程序运行的位数必须为64位,如果是32位,就会出错。

     2)c#应用程序运行的位数为64位,但是IIS Application Pool的Enable 32-Bit Applications 为true会报错。应该为false。

 2.Oracle client的位数为32位:

  原理同上。

     

猜你喜欢

转载自shuaigelingfei.iteye.com/blog/2358296