DCOM连接点问题

xbdj 2003-01-02 05:29:51
本人做了一个客户端,连接一个EXE服务器,在本地好使,分布到网上,调用Advise函数时出现80040202错误。
源对象用ATL写的,为APARTMENT。
有没有人遇到过同样的问题呀
...全文
31 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
WQ 2003-01-03
  • 打赏
  • 举报
回复
CONNECT_E_CANNOTCONNECT Error
The CONNECT_E_CANNOTCONNECT error is returned when AtlAdvise() calls the IConnectionPoint::Advise() method and fails. The ATL implementation of the IConnectionPointImpl::Advise() function calls QueryInterface() on the sink object (the client), looking for the event interface, and returns this error if it doesn't find it.


CONNECT_E_CANNOTCONNECT Error
For the CONNECT_E_CANNOTCONNECT error, verify that the event interface is in the sink, or client, COM map, as in the following example:

BEGIN_COM_MAP(CDispSink)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY_IID(DIID__MySourceEvents, IDispatch)
END_COM_MAP()
Another cause of failure might be that the event interface is a custom interface and the source, or server, is out of process (an .exe file). You need to install a marshaler for the custom interface for QueryInterface() to work across process boundaries.

If all the methods of the event interface pass automation-compatible types (they are VARIANT-compatible), you can set an attribute of "oleautomation" in the source .idl file. When an ATL server is registered, its type library is also registered. This sets up the marshaler for this interface to be the universal marshaler (in OleAut32.dll).

If the event interface passes non-automation-compatible types, then a proxy DLL needs to be built and registered. The ATL Project Wizard creates a proxy makefile in your project directory with the name <Project>.mk. You can run NMake.exe on this .mk file to build the proxy DLL.


xbdj 2003-01-03
  • 打赏
  • 举报
回复
安装了,我有另外一个客户端,在DCOM上是好用的,所以不是环境的问题。
我做的客户端连接服务器,请求接口都没问题,但是一连接连连接点就出现错误
WQ 2003-01-03
  • 打赏
  • 举报
回复
装STUB/PROXY了吗
xbdj 2003-01-03
  • 打赏
  • 举报
回复
问题解决了,但是很奇怪

我在我的客户机上配置DCOM,把服务器的帐号加上。OK了

源对象是向服务器提供服务的,可能也需要权限。
我有另外一个客户端,用C++写的,没用ATL,不用添加帐号也好用。

可我用ATL写的客户就需要添加客户,不知道ATL在启动时做了什么

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧