如何编译网站以在 64 位 Windows 上使用 32 位 Oracle 客户端 [英] How to compile a Website to use 32-bit Oracle Client on 64-bit Windows

查看:25
本文介绍了如何编译网站以在 64 位 Windows 上使用 32 位 Oracle 客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在更新到 64 位 Windows 7 然后运行现有的 .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 客户端,我知道在我的 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 客户端.

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 客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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