Using X86 COM interop with ASP.Net application in Windows x64
It has been almost two months since my last post. It has been very busy here..
I got several good notes with one my previous post, about using x86 COM interop in x64 environment. I also had few questions about using x86 COM interop with ASP.Net application in the 64-bit Windows, such as Windows Server 2003 x64, or Vista x64.
Well, IIS in 64-bit Windows is also 64-bit and uses 64-bit version of .Net Framework. You might deployed your app as pre-compiled binaries or deploying the source, either way, the same error will be thrown in the app is using a 32-bit COM interop. The same error, Retrieving the COM class factory for component with CLSID {GUID HERE} failed due to the following error: 80040154.
If you deployed the ASP.Net source code to the server, ASP.Net does the compilation and it is more challenging to force ASP.Net to compile it as 32-bit application, as the IIS itself is 64-bit.
There is a way to do it, I don't say that this is ideal, but it works.
- Configure IIS to run 32-bit ASP.Net application.
https://technet2.microsoft.com/WindowsServer/en/library/140077b8-8c96-49b0-be17-e47095983c2b1033.mspx?mfr=true - Register ASP.Net 32-bit with IIS.
Open a command-prompt window at %windows%\Microsoft.Net\Framework\v2.0.50727 and call aspnet_regiis -i. - Enable the 32-bit ASP.Net web service extension from IIS Service Manager (it is not automatically enabled from step 2).
Your ASP.Net application and your 32-bit COM interop now will work. The most ideal situation would be to get the 64-bit version of the COM interop.
Comments
Anonymous
July 16, 2008
Nice! This solved my problem. Many thanks.Anonymous
December 09, 2008
"Enable the 32-bit ASP.Net web service extension from IIS Service Manager (it is not automatically enabled from step 2)." I am not sure what you mean by this 3rd step. I am using IIS7 and I can't find that option in IIS Manager. Any help please?Anonymous
December 09, 2008
With IIS 7.0 it is much easier. Go to the advance setting of your Application Pool, and set to true this option "Enable 32-bit Applications".