开发者

System.Runtime.InteropServices.COMException (0x80040154): [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about programming within the scope defined in the help center.

Closed 4 years ago.

Improve this question

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

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {877AA开发者_如何学JAVA945-1CB2-411C-ACD7-C70B1F9E2E32} failed due to the following error: 80040154.

What could it mean?


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).


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


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.


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜