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

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

问题描述:

尝试从.net连接到oracle数据库时遇到以下异常:



尝试加载Oracle客户端库引发BadImageFormatException。这个问题将会在安装了32位Oracle客户端组件的64位模式下运行时发生



经过多次链接后,我尝试通过更改来克服此异常平台目标指向任何CPU。当我更改目标平台时,它工作正常。



由于应用程序使用Clearquest和HPQC dll,它们是32位且当我正在使用平台目标作为任何cpu或x64,获得异常



检索具有CLSID的组件的COM类工厂{94773112-72E8-11D0-A42E -00A024DED613}由于以下错误而失败:80040154未注册类(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG))。





我工作的环境是: Windows服务器2008,

.net framework 4.0,oracle 11g(64位)



谁能告诉我怎么解决?

While trying to connect to oracle database from .net getting the following exception:

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

After going through many links i tried to overcome this exception by changing the platform target to Any CPU.When i changed the target platform it is working fine.

Since the application uses Clearquest and HPQC dlls and they are of 32 bits and when i am using it with platform target as any cpu or x64 , getting exception as

"Retrieving the COM class factory for component with CLSID {94773112-72E8-11D0-A42E-00A024DED613} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."


The environment on which i am working is: Windows server 2008,
.net framework 4.0, oracle 11g (64-bit)

can anyone tell me.how to fix it?

如果clearquest仅作为32位dll可用,你显然不能在64位下运行。



将项目targetCPU设置为x86并安装32位Oracle客户端。
If clearquest is only available as 32bit dlls you obviously can''t run it under 64 bits.

Set your projects targetCPU to x86 and install the 32 bit Oracle Client.