描述:
我写了一com组件是作为进程外服务被调用了,但是调用进程退出后服务进程没有退出,我跟进去看了,最后一次调用release返回com对象的引用记数确实是0,就是说所有的引用已经被释放了,系统的服务管理中我也将自己的服务设置为自动启动了,但是就是退不出,不知道是什么问题,希望大家帮帮忙,多谢了。
解决方案1:
你作为自动启动应该是不会退出的,就象windows自带的服务一样,开机启动,你调用后它也不会退出
为什么要退出呢?那就用手动启动
Oh,I see.
When server application count reaches zero, OLE automatically calls CoSuspendClassObjects, which prevents new activation requests from coming in. This permits the server to deregister its class objects from its various threads without worry that another activation request may come in.
Maybe you can get more information from MSDN.
Try use void CoFreeUnusedLibraries(void);
It Unloads any DLLs that are no longer in use and that, when loaded, were specified to be freed automatically.