COM 异常 - TYPE_E_CANTLOADLIBRARY? [英] COM Exception - TYPE_E_CANTLOADLIBRARY?

查看:27
本文介绍了COM 异常 - TYPE_E_CANTLOADLIBRARY?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 .Net Web 应用程序中使用了 COM dll.这适用于多台不同的机器.
但是在一台特定的机器上,我收到以下错误:

I am using a COM dll in my .Net web application. This works fine on multiple different machines.
However on one particular machine I get the following error:

无法将CServer.CApplicationClass"类型的 COM 对象转换为接口类型CServer.ICApplication".此操作失败,因为 IID 为{CF0DFA28-046B-4C7D-8AA9-F4B7477D8CAE}"的接口的 COM 组件上的 QueryInterface 调用因以下错误而失败:加载类型库/DLL 时出错.(来自 HRESULT 的异常:0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

Unable to cast COM object of type 'CServer.CApplicationClass' to interface type 'CServer.ICApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{CF0DFA28-046B-4C7D-8AA9-F4B7477D8CAE} ' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

我已经使用 regsvr32 命令注册了 dll.
我还为这个 dll 创建了一个 COM+ 应用程序.通过注册表运行搜索
我可以在很多地方找到钥匙.我还尝试注销 dll 并删除计算机上对该 dll 的所有引用.然后重新添加dll并重新注册.

I have registerd the dll using the regsvr32 command.
I have also created a COM+ application for this dll. Running a search through the registry
I can find the key in numerous places. I have also tried unregistering the dll and deleting all referneces on the computer to this dll. And afterwards re-adding the dll and re-registering it.

我编写了一个简单的 windows 脚本文件来测试 dll.这工作正常.但是问题存在于我在 iis 中运行的 .net 项目中.

I have written a simple windows script file which tests the dll. This works fine. However the problem exists in my .net project which is running in iis.

谁能帮我解决这个问题?..

Can anyone help me with this?..

如果您需要更多信息,请发表评论.谢谢.

If you need anymore info please leave a comment. Thanks.

推荐答案

我遇到了类似的问题,TYPE_E_CANTLOADLIBRARY"消息.

I had a similar problem, with the "TYPE_E_CANTLOADLIBRARY" message.

背景:我有一个使用 Interop.ReferenceA.dll 的项目.该文件是使用 tlbimp ReferenceA.dll/out: Interop.ReferenceA.dll 创建的.

Background: I had a project which used Interop.ReferenceA.dll. This file was created using tlbimp ReferenceA.dll /out: Interop.ReferenceA.dll.

解决方案:当我使用 RegDllView 查看 ReferenceA.dll 时,我注意到 ReferenceA.dll 有一个子类,即错误消息中显示的 IID.我查看了子类的源代码,发现它依赖于 Interop.ReferenceB.dll.

Solution: When I took a look at ReferenceA.dll using RegDllView I noticed that ReferenceA.dll had a subclass, which was the IID shown in the error message. I looked around in the source code of the subclass and noticed that it had a dependency to Interop.ReferenceB.dll.

事实证明,子类需要 Interop.ReferenceB 作为类型库才能工作.所以我运行了这个:

Turns out that the subclass needed Interop.ReferenceB as a type-library to work. So I ran this:

regasm/tlb:Interop.ReferenceB.tlb Interop.ReferenceB.dll(使用了 32 位版本的 regasm.)

regasm /tlb:Interop.ReferenceB.tlb Interop.ReferenceB.dll (the 32-bit version of regasm was used.)

错误消失了.

这篇关于COM 异常 - TYPE_E_CANTLOADLIBRARY?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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