1. http://en.hugon.ws/articles/visual-studio/remote-debugging/

2.http://blog.csdn.net/kaylc/article/details/6179043

 

Remote debugging           

Visual Studio

Category Visual Studio                     | Publication Date : 7/5/2010

The introduction of remote debugging is problematic when both machines are not part of the same domain. The main requirement is that there must have a user account with the same name and same password on the remote machine and on the local machine (a local account and not a domain account). The second point is that Visual Studio Remote Debugger must be installed on the remote machine and be done with the user account.

Create the local account

From Windows

  • Right click on My Computer - Manage.
  • Expand Computer Management - System Tools - Local Users and Groups.
  • Right click Users under Local Users and Groups and choose New User ....
  • Enter the username and password.
  • Untick User must change password at next login and tick Password never expires and User can not change password.
  • Click on Create.
  • Click Close.

 

From the command line

Execute the following command:

net user RemoteDebugUser PASSWORD /fullname:"Remote debug Machine Account" /comment:"User for remote debugging" /passwordchg:no /expires:never /add

 

You need to update the user account by ticking the checkbox Password never expire

Create the remote account

From Windows

  • Login to the remote machine and repeat the steps from the Create local account section (username and password must be the same).
  • Right click the user then choose Properties.
  • Go on the Member Of tab.
  • Click Add....
  • Enter Administrators and then click OK.
  • Click OK.

 

From the command line

  • Login to the remote machine and repeat the steps from the Create local account section (username and password must be the same).
  • Execute the following command:

 

net localgroup administrators RemoteDebugUser /add

 

Install Visual Studio Remote Debugger

If Visual Studio is installed on the remote machine, the remote debugger too:

Visual Studio 2008

Remote debugging - Visual Studio

Visual Studio 2010

Remote debugging - Visual Studio

The installer for the Remote Debugger is on the installation disk of  Visual Studio in the folder Remote Debugger.

The installer can also be downloaded from the Microsoft site: Visual Studio 2008 et Visual Studio 2010

There is an installer for each OS version (32-bit or 64 bit).

The installation is automatic and only the license agreement must be accepted.

At the end of the installation, configuration wizard opens. Refer to Configure Visual Studio Remote Debugger for details of the configuration.

Configure Visual Studio Remote Debugger

Configure the firewall

The Remote Debugger (msvsmon.exe) must be authorized to receive and transmit information on the network. DCOM (TCP port 135) and IPSEC (UDP port 4500 and UDP port 500) must be released.

Execute Visual Studio Remote Debugger

The version of the Remote Debugger (2005 / 2008 / 2010) on the remote machine must match the version of Visual Studio used on the local machine.

Execute as an application

Start Visual Studio 2010 Remote Debugger using the  command Run as... and the user account created previously:

Remote debugging - Visual Studio

Execute as a service

Allow the user account to log on as a service:

  • Open Administrative Tools - Local Security Policy.
  • Expand Security Settings - Local Policies - User Rights Assignment.
  • Double click on Log on as a service under User Rights Assignment.
  • Click on Add User or Group....
  • Enter the username you created earlier and click OK.
  • Click OK and then close the Local Security Settings window.

 

Configure the service:

  • Start Visual Studio 2010 Remote Debugger Configuration Wizard.
  • Click Next.
  • Check the box Run the "Visual Studio 2010 Remote Debugger" service:

 

Remote debugging - Visual Studio

  • Click Next then Finish.

 

The Remote Debugger service names are the following depending on the version of Visual Studio:

Version   Service name
2005Visual Studio 2005 Remote Debugger
2008Visual Studio 2008 Remote Debugger
2010Visual Studio 10 Remote Debugger

 

Connect to the remote machine with Visual Studio

The version of Visual Studio (2005 / 2008 / 2010) on the local machine must match the version of the Remote Debugger used on the remote machine.

Open the menu Debug - Attach to Process...:

Remote debugging - Visual Studio

Log in using the user name created earlier and the name of the machine ([username]@[machinename]) in the Qualifier field then click on Refresh to get the list of process to attach:

Remote debugging - Visual Studio

Select the process and click on Attach.

Verify connections on the remote machine

If the Remote Debugger is running as an application on the remote machine, the window displays the connection:

Remote debugging - Visual Studio

If the Remote Debugger is running as a service on the remote machine, the connection can be verified from the  Event Viewer in the log Application, an event type Information is created with the source Visual Studio 2010 Remote Debugger.

===================================================================

                                       VS2008 如何实现远程调试

1.首先将要调试的应用程序拷贝至远程机,选择拷贝路径如:D:/XXX/XXX/


2.将本地工作上VS2008的安装目录下的调试监控工具msvsmon.exe拷贝到远程机上,如:X:/Program
Files/Microsoft Visual Studio 9.0/Common7/IDE/Remote
Debugger/下的x86文件夹整个拷贝到远程机上。


3.双击远程机上的msvsmon.exe,选择
tools--->Options--->Authentication Mode--->No Authentication(native
only)--->OK


4.VS2008设置具体如下:


调试机启动VS2008. 选择project->properties


然后:Configuration Properties: Debugging.


Remote Command:
远程机上需要被调试的应用程序的全路径,比如:D:/XXX/XXX/urpro.exe。


Work Directory:远程机上应用程序的工作目录,比如:D:/XXX/XXX


Remote Server Name: 远程机上的IP地址


Connection :Remote with no authentication (Native
only)


Debugger Type: Native only


Attach: No


SQL Debugging: No


5.设置断点,F5启动调试就可以进行远程调试了

 

posted on 2012-04-27 09:51  higirle  阅读(949)  评论(0)    收藏  举报