Click here to Skip to main content
16,018,534 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to connect to a COM dll on a remote server.

My code is as follows:

Type type = Type.GetTypeFromProgID("ourType.ourClass", "ourServer", true);
Object instance = Activator.CreateInstance(type);


GetType works perfectly but CreateInstance falls over with the following error:

Retrieving the COM class factory for remote component with CLSID {ourCLSID} from machine ourServer failed due to the following error: 80040154.


I'm fairly confident that the object on the remote server is registered correctly.

From what I've found so far, the error code can often indicate problems with 64-bit programs trying to talk to 32-bit objects and the suggested remedy is usually to rebuild the calling application for x86. I've tried that (and even tried targeting .NET 2.0 for good measure) and I still get the 80040154 error.

Has anyone run into this before?
Posted

1 solution

Things to try ...

1. Download the Sysinternals[^] tools (esp. ProcMon and ProcExp) - you can find out if there is another DLL that the problem one needs that isn't registered properly (it's always been this issue when I've come across similar problems)

2. Try re-registering the DLL - remember this needs to be registered on the PC not the remote server and if it is 32-bit needs to be registered with the version of regsvr32.exe that is in %windir%\SysWOW63 not the one in %windir%\System32

3. If neither of those work then use the ProcMon and other sysinternals tools to gain further insight into what is happening - see the link for details of how they work. I really do recommend them.
 
Share this answer
 
Comments
PeejayAdams 11-Mar-15 7:55am    
Thanks, CHill - sorry for the delayed reply - I'm suspecting that I'd used the non-SysWOW64 version of regsvr32 the first time round.
CHill60 12-Mar-15 4:50am    
:) Quite a common problem! It still gets me that System32 is for 64-bit but WOW64 is for 32-bit :doh: The way I fixed it in my mind is to remember WOW64 as "(Old) Windows on Windows 64 bit"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900