.net 到 COM 服务器的接口(interface)失败,出现 0x80080005

标签 .net com interop

我有一个公开 COM 接口(interface)的 native c++ COM 服务器。我可以成功地使用 native C++ 客户端应用程序从服务器获取和使用公开的接口(interface)。

当我使用引用服务器的 .net 客户端时,出现错误:

Retrieving the COM class factory for component with CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).



...即使 COM 服务器启动并成功运行(启动只需大约 1 或 2 秒)。

但是只有当服务器注册为本地服务器时,我才会收到上述错误。如果我将服务器注册为 Windows 服务,.net 客户端可以成功获取和使用接口(interface)就好了。

我在 Windows 7 64 位上以管理员身份完成所有这些工作。 COM 服务器位于本地计算机上。

我检查了下面的线程,但没有提供答案:
Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80080005

到目前为止花了一天半的时间......可能是什么问题?

更多信息:
我已经使用vs2005进行了此操作。我最近更新到 vs2010,现在遇到了这个问题。我已经尝试构建目标框架 2.0、3.5 和 4.0 的 .net 客户端,结果相同。

谢谢

最佳答案

使用在 x64 上运行的 .net 应用程序尝试连接到 32 位 COM 应用程序时,我看到了这个错误。通过将我的 .net 应用程序切换到 x86(32 位),我能够轻松修复它。

关于.net 到 COM 服务器的接口(interface)失败,出现 0x80080005,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6045335/

相关文章:

php - 在 IIS 上通过 COM 将 SAPI 与 PHP 一起使用时出现问题

.net - 如何在使用 Office 2003 打开 Office 2007 文档时禁用转换消息?

c# - 通用类和约束

c# - Windows 货币符号

c# - 在 .Net 中使用 kernel32

c# - 互操作程序集中的名称大写错误

c# - 安装项目 COM 注册

c# - `XmlConvert.ToDateTime(String)` 和 `XmlConvert.ToString(DateTime)` 输出不一致

c++ - 无法 CoCreateInstance EXE COM 服务器

windows - 在 Windows 中,有什么方法可以将 errno 转换为 HRESULT?