Windows COM-如何调试COM服务器

问题描述:

我有一个用完了进程的com服务器(用C ++,ATL编写).在我的一台计算机上,仅通过在调试器下启动COM,设置断点和从客户端进程连接到服务器,就可以轻松调试服务器代码.

I have a com server(written in C++, ATL) that runs out of process. In one of my computers I am able to debug the server code easily just by starting the COM under the debugger, setting breakpoints and connection to the server from a client process.

在我的另一台计算机上不会发生这种情况,如果我从头开始在调试器下启动COM服务器,则客户端将使用同一服务器的另一实例,并且调试服务器的唯一方法是在客户端已经安装后再连接到该服务器.开始了.如何配置?

On my another computer this does not happen, if I start the COM server under the debugger from start, the client uses another instance of the same server and the only way to debug the server is to attch to it after the client already started it. How can this be configured ?

问题在于,在Vista或更高版本下,启动com服务器时,该目录会提升(这样,注册表部分便会在构建结束时进入注册表)),COM客户端将启动另一个COM服务器实例(处于与他相同的完整性级别,例如中等而不是高)

The problem was the fact that under the Vista and up when you start the com server elevated (so that the registry part gets in registry at the end of the build) the COM client will launch another COM server instance (at the same integrity level as he was, e.g. medium and not high)

因此,我必须以普通用户身份(不是以admin身份运行)为服务器运行Visual Studio,并且必须从命令行进行COM注册.

So I had to run Visual Studio for the server as normal user (not run as admin) and had to do the COM registration from command line.