COM 异常 - TYPE_E_CANTLOADLIBRARY?

发布于 2024-11-02 06:16:43 字数 597 浏览 2 评论 0原文

我在 .Net Web 应用程序中使用 COM dll。这在多台不同的机器上运行良好。
然而,在一台特定的计算机上,我收到以下错误:

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

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

我编写了一个简单的 Windows 脚本文件来测试 dll。这很好用。但是,问题存在于我在 iis 中运行的 .net 项目中。

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

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

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:

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)).

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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

睫毛溺水了 2024-11-09 06:16:43

我遇到了类似的问题,出现“TYPE_E_CANTLOADLIBRARY”消息。

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

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

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

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

并且错误消失了。

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

Background:
I had a project which used Interop.ReferenceA.dll. This file was created using tlbimp ReferenceA.dll /out: Interop.ReferenceA.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.

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 (the 32-bit version of regasm was used.)

And the error went away.

半暖夏伤 2024-11-09 06:16:43

确保您的 AppPool 设置为 x86。还要确保您的程序集仅针对 x86。

Make sure your AppPool is set to x86. Also make sure your assembly is targeting only x86.

烙印 2024-11-09 06:16:43

我也有类似的问题。首先遇到“访问被拒绝”,经过一番查找后解决了,却遇到了此错误消息(TYPE_E_CANTLOADLIBRARY)。请注意,我正在 Windows 7 上运行 COM+ 组件。

经过一些涉及弄乱注册表的徒劳尝试后,我和我的同事找到了一种启动并运行它的方法:

1) 注销您的 dll (regsvr32 -u dllname)

2 ) 确保从注册表中清除对 dll 的引用(首先备份)

3) 在组件服务中创建一个空的 com+ 应用程序(服务器应用程序)

4) 将应用程序 ID 复制到剪贴板

5) 转到“c:\program files (x86)\Complus applications”并在剪贴板上创建一个带有 id 的文件夹

6) 将 dll 复制到该文件夹​​中并注册

7) 返回组件服务并添加组件到您使用“c:\program files (x86)\Complus applications{*app id*}”上的 dll 创建的应用程序,

该应用程序为我完成了此操作。希望有帮助。

I was having a similar issue. First got Access Denied, which after some looking around was resolved, only to be faced with this error message (TYPE_E_CANTLOADLIBRARY). Mind that I'm running a COM+ Component on Windows 7.

After some fruitless attempts which involved messing with the registry, my workmate and I found a way of getting it up and running:

1) Unregister your dll (regsvr32 -u dllname)

2) make sure your references to the dll are cleared up from registry (backup first)

3) Create an empty com+ application (server app) in Component Services

4) Copy the application id to the clipboard

5) go to "c:\program files (x86)\Complus applications" and create a folder with the id on your clipboard

6) copy your dll into that folder and register it

7) Go back to your Component Services and add the component to the app you created using the dll on "c:\program files (x86)\Complus applications{*app id*}"

that did it for me. Hope it helps.

如梦初醒的夏天 2024-11-09 06:16:43

我遇到了类似的问题,错误在我的电脑上触发,但在其他开发人员的电脑上没有触发。

事实证明,我一直在我的 PC 上测试自动构建过程,该过程更新了程序集的版本号,从而在注册表中注册了 TLB,其版本号高于我们通常使用的版本号。

当尝试获取接口时,服务器始终使用错误的 TLB 信息,从而导致错误的程序集。一旦我删除了注册表中的更高版本条目,它就工作正常了。

现在我们只需要确保构建过程不会再次导致该问题。 :)

I had a similar problem where the error was triggered on my PC but not on that of other developers.

It turns out that I had been testing an automatic build process on my PC that had updated the version number of the assembly, thus registering the TLB in the registry with a version number higher than the one we were normally using.

When trying to get the interface, the server was consistently using the wrong TLB information leading to the wrong assembly. Once I deleted the higher version entry in the registry, it worked fine.

Now we just have to ensure the build process is not going to cause that issue again. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文