Calling 32-bit COM object fails 80040154
-
Thursday, November 01, 2007 5:38 PM
I have a .NET project that normally calls into 32-bit COM objects. I would like to port it to 64-bit but there is one COM object that must remain 32-bit.
When the project runs, it gives an error "Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80040154." The error is 'Class not registered'.
Having researched the issue, on 64-bit Windows my 32-bit COM dlls are registered in HKCR\Wow6432Node\CLSID instead of the normal HKCR\CLSID. When my .NET project runs in 32-bit, it looks to HKCR\Wow6432Node\CLSID and finds the correct object there. When it runs 64-bit, it looks to HKCR\CLSID and doesn't find it.
I thought if I compiled my interop assembly to only target 32-bit, it might work. However, the 64-bit app did not like working with the 32-bit interop assembly at all.
Does anyone know how to do this correctly?
All Replies
-
Monday, November 05, 2007 4:54 AMModerator
Hi sparticus,
Yes you can’t use a 32bit in-process COM in your 64bit compiled .net application, because the COM library needs to load the COM dll into your application’s process space.
To work around this issue, either recompile your application as 32bit or write a out-of-process COM component which wrap the 32bit COM DLL, and use this out-of-process COM component in your .net application. Check out this Creating the out of proc COM Server in C++. Or you can isolate the COM dll into a separate process using COM+, for more details, please visit How to Isolate a DLL into a Separate Process By Using Component Services.
Hope this helps!
Thanks!
-
Friday, July 01, 2011 3:13 AM
Hi Feng,
I tried to use the later solution you provided.
After created the COM+ application in Component Services, I saw it creates a process named "dllhost.exe *32" which hosts my COM object. It was still a 32-bit process.
Please have a look at my case and help:
I'm having:
A COM component is wrote by Delphi, and is compiled with LAA (LARGEADDRESSAWARE) so it supports 64-bit.
A WinForm application is wrote by C# and needs to call some methods in the above COM component.
The methods need large memory like 1G to 3G.
Thanks!

