基于ATL的Com服务注册后被调用,CoCreateInstance返回0x80080005,服务启动失败

在使用ATL创建的COM服务项目中,遇到跨进程调用失败的问题,表现为CoCreateInstance返回0x80080005错误。问题的根本原因是新生成的CoClass的rgs文件缺少AppID的注册信息。通过在rgs文件中手动添加AppID的代码行并重新编译,可以修复这个Visual Studio 2008的bug,从而解决服务启动失败的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言

最近一边在搞新项目,一边又在整理公司一个老Windows项目代码,结果发现有这样一个问题,跨进程调用已注册的基于ATL实现的com服务程序时会存在调用失败的情况,而不注册为服务却能正常调用,调试发现CoCreateInstance阻塞了十几秒,调用失败并返回0x80080005,以下是本人的解决方案。

解决方案

Generally this means Server (out of process server, either stand alone EXE or service) did not respond to RPCSS within definite time about COM server's successful start. Many things could have happened (may be Server got some exception/error, or server got crashed!)

But in this case, even if I start the service before making call from client, I get same response from client. Something else was wrong! And after lots of checks here and there, we found

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宇龍_

若帮助到你,希望能给予鼓励!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值