尝试加载Oracle客户端库会引发BadImageFormatException。 [英] Attempt to load Oracle client libraries threw BadImageFormatException.

查看:935
本文介绍了尝试加载Oracle客户端库会引发BadImageFormatException。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对所有人来说,



我知道这个网站上有这个问题的解决方案,但它对我不起作用。

我是网络开发的新手,我可能做了一些非常基本的错误。

我正在运行Windows 7 64位和Visual Studio 2008.



我正在将WPF应用程序移植到Web应用程序。该应用程序使用Oracle客户端连接到数据库。在连接(.Open())时,它抛出错误:



尝试加载Oracle客户端库引发BadImageFormatException。运行时会出现此问题在64位模式下安装了32位Oracle客户端组件。



我在桌面上运行Web应用程序,而不是在服务器上运行点。桌面应用程序可以很好地连接数据库并使用位于文件夹中的32位版本的OracleClient dll:



Windows \ Microsoftoft.NET \ Framework \\ \\ v2.0.50727



IIS设置为此版本(v2.050727),启用32位应用程序设置为false。



我尝试过使用32位Oracle客户端和64位版本:



Windows \ Microsoftoft.NET \\ Framework64 \v2.0.50727



我继续得到同样的错误。



如果有人可以帮助,我将不胜感激。



提前致谢,

格洛丽亚

解决方案

您不能在单个进程中将程序集(或非托管模块)与不同的指令集体系结构混合在一起。检查每个模块。通常,如果将所有程序集构建为AnyCPU,则在运行时实际使用的最终指令集体系结构将由机器的实际体系结构定义。



请注意,在所有64位系统上,32位进程将通过WoW64工作:

http:// en.wikipedia.org/wiki/WOW64 [ ^ ]。



与此同时,不同的64位架构也会发生冲突:x86-64和Itanium(I-64)。



我无法想象当你需要Web应用程序中除AnyCPU之外的目标指令集架构时的情况。



参见: http://en.wikipedia.org/wiki/Instruction_set [ ^ ]。



-S A

To all,

I know there is a solution to this problem on this website but it is not working for me.
I am new to web development and am probably doing something very basic wrong.
I am running Windows 7 64-bit and Visual Studio 2008.

I am porting a WPF application to a web application. The application uses Oracle Client to connect to the database. Upon connection (.Open()), it is throwing the error:

"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."

I am running the web application on my desktop and not on a server at this point. The desktop application connects to the database fine and uses the 32-bit version of the OracleClient dll located in the folder:

Windows\Microsoft.NET\Framework\v2.0.50727

The IIS is set to this version (v2.050727) and Enable 32-bit applications is set to false.

I have tried using the 32-bit Oracle Client and the 64-bit version located:

Windows\Microsoft.NET\Framework64\v2.0.50727

I continue to get the same error.

If anyone can help, I would greatly appreciate it.

Thanks in advance,
Gloria

解决方案

You cannot mix the assemblies (or unmanaged modules) with different instruction-set architectures in a single process. Check up each and every module. Normally, if you build all the assemblies as "AnyCPU", the ultimate instruction-set architectures actually used during runtime will be defined by the actual architecture of the machine.

Note that on all 64-bit systems, 32-bit process will work via WoW64:
http://en.wikipedia.org/wiki/WOW64[^].

At the same time, different 64-bit architectures wull also conflict: x86-64 and Itanium (I-64).

I cannot imagine the situation when you might need the target instruction-set architecture other then AnyCPU in a Web application.

See also: http://en.wikipedia.org/wiki/Instruction_set[^].

—SA


这篇关于尝试加载Oracle客户端库会引发BadImageFormatException。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆