尝试加载Oracle客户端库会引发BadImageFormatException

Liz*_*iza 6 .net oracle wpf

尝试从.net连接到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.

在经历了许多链接后,我试图通过将平台目标更改为任何CPU来克服此异常.因为它是wpf应用程序,在更改平台目标后,它会抛出以下异常:

'The invocation of the constructor on type 'SSC_GIP_UI.MainWindow' that matches the specified binding constraints threw an exception.' Line number '3' and line position '9'.

但它运行平台目标x86没有抛出上述异常,但它抛出BadImageFormatException.

我正在工作的环境是:Windows server 2008,
.net framework 4.0,oracle 11g(64位)

谁能告诉我怎么解决?

GTG*_*GTG 6

此错误表示应用程序中的32位和64位组件之间存在不匹配.

当您在64位Windows中运行应用程序时,它可以作为64位或32位运行.如果已将平台目标设置为x86,则它将以32位运行.如果您将平台目标设置为x64或AnyCpu,它将以64位运行.

Oracle有不同版本的客户端,一个是32位,另一个是64位.因此,如果您的应用程序以32位模式运行,则需要确保安装了32位Oracle客户端.


Nja*_*jal 5

我想也许你必须:打开IIS,找到这个应用程序使用的应用程序池转到该应用程序池,在"启用32位应用程序"中设置标记