System.Runtime.InteropServices.COMException:检索具有CLSID {58968145-CF05-4341-995F-2EE093F6ABA3}的组件的COM类工厂失败 [英] System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {58968145-CF05-4341-995F-2EE093F6ABA3} failed

查看:255
本文介绍了System.Runtime.InteropServices.COMException:检索具有CLSID {58968145-CF05-4341-995F-2EE093F6ABA3}的组件的COM类工厂失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行C#应用程序,并且正在使用DSOFile dll。在项目中引用此DLL。我可以在我的开发机器上运行exe。
但是,当我在另一台机器上运行exe时,我得到了


未处理的异常:System.Runtime.InteropServices.COMException:由于以下错误,无法为具有CLSID {58968145-CF05-4341-995F-2EE093F6ABA3}的组件检索COM类工厂:80040154未注册类(HRESULT的异常:0x80040154(REGDB_E_CLASSNOTREG))。


不确定我为什么得到这个。用谷歌搜索并将平台目标设置为x86
但是我仍然遇到这个问题。任何帮助都将非常有用。

解决方案




这是我们对话的摘要,







80040154未注册类(HRESULT的异常:0x80040154( REGDB_E_CLASSNOTREG)。


这意味着您要实例化的COM对象是未注册COM的类。 COM使用注册表来维护类注册。



尝试从命令行使用管理员权限执行 regsvr32.exe DSOFile.dll 目标系统。


我不记得在开发机中这样做了。这让我想知道还有其他东西不见了


是的,请尝试以下检查:



快速检查



我建议使用Microsoft的免费工具 OleView (通常与Visual Studio一起安装)来检查所有COM,但如果没有,请打开RegEdit并查看是否存在以下密钥:

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

如果目标计算机上不存在该文件,



如果存在,请展开上面的键,您应该看到一个名为 InprocServer32 的子键。此密钥的(默认)值将是DLL的路径,在本例中为DSOFile.dll。



更多



如果要使用OleView,请看一下:



C:\Program Files(x86)\Microsoft Windows XP v7.0A Windows XP SDK

实际位置可能会因我怀疑安装的Visual Studio或Windows SDK版本而异。



运行后,在自动化对象中查找您的班级。





如果失败,请在所有对象中查看。




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.

解决方案


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.

这篇关于System.Runtime.InteropServices.COMException:检索具有CLSID {58968145-CF05-4341-995F-2EE093F6ABA3}的组件的COM类工厂失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆