开发者

How to compile a Website to use 32-bit Oracle Client on 64-bit Windows

开发者 https://www.devze.com 2022-12-10 20:13 出处:网络
I have received this error after updating to Windows 7 64-bit and then running an existing .NET Website.

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开发者_如何学Python 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号