CLSIDFromProgID成功,但CreateInstace失败!为什么? [英] CLSIDFromProgID is successful but CreateInstace fails! Why?

查看:329
本文介绍了CLSIDFromProgID成功,但CreateInstace失败!为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个COM对象的实例。我有实现接口的类名,我得到一个CLSID通过使用CLSIDFromProgID()。所以,因为我得到一个CLSID我认为一切都应该从现在开始。然而,当我调用CreateInstance并传入CLSID,我得到一个错误,类未注册。此外,我得到这个错误只在一些电脑。它在几台计算机上运行无错误。我不明白问题可能在哪里。我的注册表是否脏?有人知道这里发生了什么吗?感谢您的帮助!

I am trying to create an instance of a COM object. I have the class name that implements the interface and I get a CLSID by using CLSIDFromProgID(). So since I am getting a CLSID I thought everything should be fine from now on. However when I do a call to CreateInstance and pass in the CLSID, I get an error saying "Class not registered". Also I get this error only in some computers. It runs error free on several computers. I don't understand where the problem could be. Is my registry dirty? Does anyone know what is going on here? Thanks for your help!

我只想补充一点,这是一个.NET COM类。

I just want to add that this is a .NET COM class. The appropriate entries are in the registry and the DLL is in the GAC.

推荐答案

感谢您的回答。 .Net程序集已正确注册并存在于GAC中。一个绝对确认这一点的应用程序是Process Explorer。您可以查看由每个应用程序加载的DLL。所以从这里我能够看到,实例化COM对象的应用程序是否实际上能够加载DLL或不是。我发现这确实发生了。问题是由于不同的区域设置。我们发现应用程序在区域未设置为US时抛出异常。此问题已修复。错误消息类未注册不是非常有帮助。谢谢,这是一个快速修复。

Thanks for your answers. The .Net assemblies were registered properly and were present in the GAC. One application that absolutely confirmed this was Process Explorer. You can view the dlls that are loaded by each application. So from here I was able to see if the application that was instantiating the COM objects was actually able to load the DLLs or not. I found out that this was indeed happening. The problem was due to different Regional settings. We found that the application threw an exception when the region was not set to US. This issue was fixed. The error message "Class not registered" was not very helpful. Thankfully it was a quick fix.

这篇关于CLSIDFromProgID成功,但CreateInstace失败!为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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