System.Runtime.InteropServices.COMException (0x80040154):

16

I'm getting an exception in a c# project:

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {877AA945-1CB2-411C-ACD7-C70B1F9E2E32} failed due to the following error: 80040154.

What could it mean?

c#
exception
asked on Stack Overflow Jan 11, 2011 by Charles Ma • edited Dec 2, 2016 by Craig W.

4 Answers

30

It means the class id 877AA945-1CB2-411C-ACD7-C70B1F9E2E32 is not in the registry.

You can verify this by opening regedit.exe, browsing to HKEY_CLASSES_ROOT\CLSID\{877AA945-1CB2-411C-ACD7-C70B1F9E2E32}. If your running a 32-bit app on a 64 bit OS, look for HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{877AA945-1CB2-411C-ACD7-C70B1F9E2E32}

If it is there, it may be some other issue but it is probably missing. To resolve this you will usually run the installer that distributes this COM object. If you don't have one and you know what dll implements the object, you can run regsvr32.exe (or regasm.exe for a managed dll).

answered on Stack Overflow Jan 12, 2011 by csharptest.net • edited Nov 9, 2012 by Doug Porter
2

I was running a C++ COM DLL from a Win Forms C# project on a 64-bit OS. I changed the Win Forms C# project to be x86, re-ran, and it worked. To do this:-

  1. Right-click the .NET project, and choose Properties
  2. Select the Build tab
  3. Set Platform target to x86
  4. Recompile, and re-run

Concept of changing bitness from George J's answer

answered on Stack Overflow Apr 25, 2018 by CJBS
1

I am running some automated tests in Selenium and had same problem. Problem was solved by switching "Default Processor Architecture" to x86 in Test Settings.

answered on Stack Overflow Jun 20, 2017 by George J
0

In my case the Class was registered properly.

But the Enable 32-bit Applications property of the IIS Application pool of the Application which uses the class was set to True. It was not finding it because the application was built in ANY CPU / 64 bit mode.

Setting Enable 32-bit Applications to False fixed the issue.

answered on Stack Overflow Sep 19, 2017 by Bhupinderjit Dhanoa

User contributions licensed under CC BY-SA 3.0