Visual Studio远程调试可扩展性 [英] Visual Studio Remote Debugging Extensibility
问题描述
我正在尝试使用类似于以下代码的方式连接到远程计算机:
I'm trying to attach to a remote machine with code similar to the following:
Debugger2 db (Debugger2)dte.Debugger;
Transport trans = db.Transports.Item("Default");
Process2 proc2 = (Process2)db.GetProcesses(trans, "MACHINENAME").Item("SERVICENAME");
proc2.Attach2();
我已经通过在远程桌面上登录并手动启动调试器来使其工作,但是我必须保持登录状态.问题是,我不想保持登录到远程计算机的状态.有没有一种自动启动调试器的方法,类似于我通过IDE附加时会发生的情况?
I've gotten it to work by logging on through remote desktop and manually starting the debugger, but I have to stay logged in. The problem is, I don't want to stay logged into the remote machine. Is there a way to automatically launch the debugger, similar to what happens when I attach through the IDE?
推荐答案
您可以将调试代码包装为Windows服务,该服务在启动时以较高的特权执行.
You could wrap your debugging code as a Windows service that executes at startup with hightened privileges.
但是,我不建议您使用该路线 ,因为根据经验,我认为这对于最可能需要的东西来说是过大的杀伤力.您能否解释为什么要自动将调试器附加到远程进程?
However, I don't recommend that route, because based on experience I think it's over-kill for what is most likely needed. Could you expand on why you want to attach a debugger to a remote process automatically?
我的猜测是您想做一些最适合WinDbg的事情.类似于这些.
My guess is that you want to do something that would be best suited for WinDbg. Something similar to these.
- Enabling windbg to break on clr exceptions
- Configuring a service to start with windbg debugger attached
但是,如果没有更多关于您要完成的工作的背景信息,我显然只是在猜测.
But, without more background information on what you are trying to accomplish, I'm obviously just guessing.
这篇关于Visual Studio远程调试可扩展性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!