VS2010:在 .NET 2 项目中使用 COM
我有一个 .NET 2.0 项目需要使用 COM 组件(特别是 Redemption)。在 Visual Studio 2010 中,我添加了对 COM dll 的引用,就像在所有以前的 VS 版本中一样(右键单击项目 -> 添加引用 -> COM 选项卡 -> 选择产品 -> 确定)。当我构建并尝试运行该应用程序时,我不断收到以下错误:
由于以下错误,从 IClassFactory 创建 CLSID {29AB7A12-B531-450E-8F7A-EA94C2F3C05F} 的 COM 组件实例失败:80004005。
我没有太多运气弄清楚这是怎么回事。错误。
我已经验证运行该应用程序的计算机确实具有通过 regsvr32.exe 注册的 COM dll。
我唯一能想到的是,这与 Visual Studio 2010 导入 COM 组件的方式(也许?)与以前的版本不同有关?任何关于这方面的指导都会非常有帮助。
提前致谢。
编辑:用于实例化 COM 类的代码。
RDOSession 会话 = new RDOSessionClass();
I have a .NET 2.0 project that needs to use a COM component (specifically Redemption). In Visual Studio 2010 I add a reference to the COM dll as I would in all prior VS versions (right click project->Add Reference->COM tab->select product->Ok). When I build and try and run the app I keep getting the following error:
Creating an instance of the COM component with CLSID {29AB7A12-B531-450E-8F7A-EA94C2F3C05F} from the IClassFactory failed due to the following error: 80004005.
I haven't had much luck figuring out what is up with this error.
I have already verified that the machine the app is running on does have the COM dll registered via regsvr32.exe.
The only thing I could think of is that this has something to do with Visual Studio 2010 importing COM components differently (maybe?) than previous versions? Any direction on this would be extremely helpful.
Thanks in advance.
EDIT: Code used to instantiate the COM class.
RDOSession session = new RDOSessionClass();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那是 E_FAIL,“未指定的错误”。这是一个完全无用的错误代码,但对于 COM 服务器来说并不罕见。程序员走了一条捷径,找不到更好的错误代码,也不想创建自己的错误代码。非常怀疑它与互操作库有什么关系,你从来没有达到实际使用它的地步。
也许是 COM 服务器需要某种配置,也许是安装问题。但这些只是疯狂的猜测。最终,您可能需要组件供应商或作者的帮助才能克服这个困难。
That's E_FAIL, "Unspecified error". It's an utterly useless error code but not uncommon for COM servers. The programmer took a shortcut, couldn't find a better error code and didn't want to create his own. It is very doubtful that it has anything to do with the interop library, you never got to the point of actually using it.
Maybe some kind of config that the COM server needs, maybe an installation problem. But these are just wild guesses. Ultimately you probably need help from the component vendor or author to get past this hump.