gpt4 book ai didi

c# - IIS 64 位 Com dll

转载 作者:行者123 更新时间:2023-11-30 12:13:57 25 4
gpt4 key购买 nike

您好,我正在开发一个应用程序,我需要通过网络服务访问 com DLL。

我在 win 7 上运行 IIS 7 并使用 vs2010 进行开发。

在开发环境中一切正常,但是当我发布到本地主机上的 IIS 进行进一步测试时,出现以下错误:

System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {29345FBB-4DE7-4838-9464-5A886B775677} failed due to the following error: 80040154.

我查了一下,发现如果我将我的应用程序池设置更改为“启用 32 位应用程序”为真。这会绕过错误,我这样做了,现在我收到以下错误:

Unable to cast COM object of type 'ComName.ComClassClass' to interface type 'ComName._ComClass'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{003B251B-6F4E-42A5-8111-11DB41F1D14A}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

我完全不知道去哪里找,已经用谷歌搜索了,似乎找不到答案,有没有人知道发生了什么?

最佳答案

COM dll 需要在 IIS 服务器上注册。安装安装该 COM dll 的软件或使用 regsvr32.exe "C:..\yourdll.dll"手动安装


[窗口标题]RegSvr32

[内容]

要注册一个模块,您必须提供一个二进制名称。

用法:regsvr32 [/u] [/s] [/n] [/i[:cmdline]] dllname

/u - 注销服务器

/s - 静音;不显示消息框

/i - 调用 DllInstall 传递给它一个可选的 [cmdline];与/u 一起使用时调用 dll 卸载

/n - 不调用 DllRegisterServer;此选项必须与/i 一起使用


如果您认为它已经注册,那么取消注册并重新注册,也许做一个 iisreset :)

示例(假设您的 dll 直接位于 C:\中):

C:>regsvr32.exe/u thecomdll.dll

C:>regsvr32.exe thecomdll.dll

关于c# - IIS 64 位 Com dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10688475/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com