如何编译网站以在 64 位 Windows 上使用 32 位 Oracle 客户端

发布于 2024-08-10 21:11:47 字数 467 浏览 3 评论 0原文

更新到 Windows 7 64 位并运行现有的 .NET 网站后,我收到此错误。

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

我只安装了 32 位 Oracle 客户端,并且我知道在我的 64 位开发计算机上,应用程序需要 64 位库除非明确说明。这是我迄今为止所做的搜索。

我读过,我可以将解决方案平台更改为 x86,这将指示应用程序使用 32 位(如果它找到的话)。我想这样做,但 Visual Studio 解决方案中的网站没有 x86 选项。

我创建了一个测试应用程序,我可以选择,我创建了一个测试网站,但没有。如何将网站编译为 x86,以便它使用 32 位 Oracle 客户端。

干杯

I have received this error after updating to Windows 7 64-bit and then running an existing .NET Website.

[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.]

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.

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.

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.

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缱绻入梦 2024-08-17 21:11:47

在 IIS 管理器中,创建一个应用程序池并将该应用程序池设置为在 32 位模式下运行。然后使用 32 位 Oracle 客户端分配您的网站以在该 32 位应用程序池中运行。

由于 IIS 为该应用程序池启动的工作进程是 32 位进程,因此当它尝试加载 CLR 时,它将加载 32 位 CLR,因此将以 32 位模式加载程序集。即使您的程序集是针对 64 位和 32 位模式编译的,情况也是如此。然后,以 32 位模式运行的程序集可以调用以 32 位模式运行的 Oracle 客户端。

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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文