如何编译网站以在64位Windows上使用32位Oracle Client [英] How to compile a Website to use 32-bit Oracle Client on 64-bit Windows
问题描述
在更新到Windows 7 64位并运行现有的.NET网站后,我收到此错误。
I have received this error after updating to Windows 7 64-bit and then running an existing .NET Website.
[InvalidOperationException:尝试加载Oracle客户端库时抛出BadImageFormatException。在安装了32位Oracle客户端组件的64位模式下运行时,会发生此问题。]
[InvalidOperationException: 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.]
我只安装了32-位的Oracle Client已安装,并且我了解在我的64位开发计算机上,该应用程序期望使用64位库,除非明确说明。
I have only installed the 32-bit Oracle Client installed and I understand that on my 64-bit development machine the application is expecting 64-bit libraries UNLESS explicitly stated. This is from the searching I have done so far.
我已阅读到可以将解决方案平台更改为x86,如果这样的话,它将指示应用程序使用32位。它发现了什么。我想这样做,但是Visual Studio解决方案中网站没有x86选项。
I have read that I can change the Solution Platform to x86 which will instruct the application to use 32-bit if that's what it finds. I would like to do this but there is no x86 option for the Website in the Visual Studio solution.
我创建了一个测试应用程序,并且有一个选项,我创建了一个测试网站,但没有。如何将网站编译为x86,以便它将使用32位Oracle Client。
I created the a test application and I have the option, I created a test website and it didn't. How can I compile a website to x86 so that it will use the 32-bit Oracle Client.
欢呼声
推荐答案
在IIS管理器中,创建一个应用程序池并将该应用程序池设置为以32位模式运行。然后,使用32位Oracle客户端分配您的网站以在该32位应用程序池中运行。
In IIS Manager, create an Application Pool and set that Application Pool to run in 32-bit mode. Then assign your website using 32-bit Oracle Client to run in that 32-bit Application Pool.
因为IIS为该应用程序池启动的辅助进程是32-位进程,当它尝试加载CLR时,它将加载32位CLR,因此将以32位模式加载程序集。即使您的程序集是为64位和32位模式编译的,也是如此。然后,以32位模式运行的程序集可以调用以32位模式运行的Oracle客户端。
Because the worker process that IIS starts for that Application Pool is a 32-bit process, when it tries to load the CLR it will load the 32-bit CLR and therefore will load your assembly in 32-bit mode. This is true even if your assembly was compiled for 64-bit and 32-bit modes. Your assembly running in 32-bit mode can then call the Oracle Client running in 32-bit mode.
这篇关于如何编译网站以在64位Windows上使用32位Oracle Client的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!