System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {58968145-CF05-4341-995F-2EE093F6ABA3} failed

随声附和 提交于 2019-12-01 11:16:58

问题


I am running a c# application and I am using DSOFile dll. This DLL is referenced in the project. I am able to run the exe in my development machine. But when I run the exe in another machine, I am getting

Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {58968145-CF05-4341-995F-2EE093F6ABA3} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Not sure why I am getting this. Have googled and set the Platform target to x86 But still I am getting this issue. Any help would be great.


回答1:



This is a summary of our conversation that took place beneath the question.


80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

That means COM object you are trying to instantiate is a class that is not COM registered. COM uses the registry to maintain class registrations.

Try doing a regsvr32.exe DSOFile.dll from the command-line with admin rights on the target system.

I dont remember doing this in my Dev machine. This makes me wondering is there something else I am missing

Yes, try the following check:

Quick check

I recommend using Microsoft's free tool OleView (normally installed with Visual Studio) to check all things COM but in the event you don't have it, open up RegEdit and see if the following key exists:

HKCR\CLSID\{58968145-CF05-4341-995F-2EE093F6ABA3}

If it's not present on the target machine, then DSOFile is not registered.

If it is there, expand the above key and you should see a child key called InprocServer32. The (Default) value for this key will be the path to the DLL, in this case DSOFile.dll.

More

If you want to use OleView, take a look in:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\

Actual location may vary based on version of Visual Studio or Windows SDKs installed I suspect.

Once running, look in Automation Objects for your class.

Failing that, look in All Objects.



来源:https://stackoverflow.com/questions/35284589/system-runtime-interopservices-comexception-retrieving-the-com-class-factory-fo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!