How to: Set Up Remote Debugging

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Standard

Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Pro and Team

Topic applies Topic applies Topic applies Topic does not apply

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default

To enable remote debugging, you can do one of two things:

  • Install the Remote Debugging Monitor (msvsmon.exe) on the remote computer and start it when you begin debugging.

  • Run the Remote Debugging Monitor remotely from a share.

    Running the Remote Debugging Monitor from a file share is the easiest way to enable remote debugging. Visual Studio installs msvsmon.exe into these directories:

Install path\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86

Install path\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x64

Install path\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\ia64

The IA64 components are available only with Visual Studio Team System.

When you install Visual Studio on a 64-bit operating system, remote debugging components for both 64-bit and x86 are installed.

When you install Visual Studio on an x86 operating system, remote debugging components for x86 are installed by default.  64-bit debugging components are installed if you choose the appropriate option during installation.

When you install the Remote Debugging Monitor on an x86 operating system, only the x86 remote debugging components are installed; there is no option for installing 64-bit components.

By sharing out the Remote Debugger directory on the Visual Studio computer, you can run msvsmon.exe on the remote computer.

The following debugger features do not work when the Remote Debugging Monitor is run from a share:

  • Stepping into an XML Web service (manual attach is still possible).

  • Automatically debugging a ASP.NET Web application (again, manual attach is still possible).

As an alternative to running from a share, you can use the Visual Studio 2005 Remote Debugger CD to install the necessary remote debugging components on the remote computer. This installation provides access to all remote debugging features.

When you run the Remote Debugger installation on an x86 operating system, only the x86 remote debugging components are installed; there is no option for installing 64-bit components. If you run it on a 64-bit operating system, both x86 and 64-bit components are installed.

For certain debugging scenarios, you must install additional components.

To install remote debugging components

  1. The Remote Debugger is available on the last disc of your Visual Studio installation set. Insert this disc in the remote computer.

    For example, if you have four discs in your installation set, insert disc 4 in the remote computer. If you have a DVD instead of a CD, insert the DVD.

  2. In Windows Explorer, open the CD/DVD. Locate the Remote Debugger folder (on the CD) or vs/Remote Debugger (on the DVD).

  3. In the Remote Debugger folder, open the subfolder that matches your operating system (x86, x64, or IA64).

  4. Start the copy of rdbgsetup.exe located in that subfolder, and follow the instructions to complete setup.

    If you prefer, you can install the remote debugging components by copying the files manually. See Remote Debugging Components for a list of required components and their install locations.

    Visual Studio includes separate versions of the Remote Debugging Monitor for 32-bit and 64-bit operating systems. If you use rdbgsetup.exe, the Remote Components Setup will automatically install the correct version of the Remote Debugging Monitor. If you decide to copy the files manually, you must make sure that you have copied the correct version.

  5. After you have installed the remote debugging components, you must make sure that you have the required permissions to debug a program on the remote computer. See Remote Debugging Permissions for a list of required permissions.

Configuring the Windows Firewall

The Windows Firewall must be configured to enable remote debugging. When you start remote debugging for the first time, Visual Studio performs the necessary configuration on the Visual Studio host computer. Similarly, when you run the Remote Debugging Monitor on a remote computer for the first time, the Remote Debugging Monitor configures the Windows Firewall on that end.

In Windows XP, this configuration is transparent and automatic; however, in Windows Vista, the new security model requires that you grant permission before the software can configure the firewall. This permission is granted through the User Access Control dialog box. For a description of the new security model and User Access Control (UAC), see The Windows Vista Security Model.

When the Remote Debugging Monitor has to configure the Windows Firewall on the remote computer, the User Access Control dialog box appears on the remote computer. If the remote computer is not visible, you may not realize that the User Access Control dialog box has appeared on its monitor. In that case, you may mistakenly believe that remote debugging has stopped responding. In reality, the Remote Debugging Monitor is just waiting for someone to grant UAC permission on the remote computer.

One way to avoid this problem is to preconfigure the firewall on the remote computer by using the Remote Debugger Configuration Wizard.

It is highly unlikely that you will ever have to configure the Windows Firewall manually. If you do have to configure it manually, first see How to: Manually Configure the Windows XP Firewall for Remote Debugging or How to: Manually Configure the Windows Vista Firewall for Remote Debugging.

To configure the Windows Firewall by using the Remote Debugger Configuration Wizard

  1. Make sure that the remote debugging components have been installed on the computer.

  2. Click Start, point to All Programs, point to Visual Studio 2008, point to Visual Studio Tools, and then click Visual Studio Remote Debugger Configuration Wizard.

  3. Click Start, point to All Programs, point to Visual Studio 2008, point to Visual Studio Tools, and then click Remote Debugger.

  4. Follow the instructions in the Remote Debugger Configuration Wizard.

Web Server Debugging

To enable Web server debugging on Windows Vista or Windows XP SP2

Starting Remote Debugging

To start remote debugging

  1. Make sure that you have the necessary remote debugging permissions on the remote computer. For more information, see Remote Debugging Permissions.

  2. For remote debugging other than SQL, make sure that you are running the Remote Debugging Monitor on the remote computer. For more information, see How to: Run the Remote Debugging Monitor.

    When you are debugging SQL, the Remote Debugging Monitor will start automatically during debugging.

  3. Start Visual Studio on the debugger host.

  4. Use Visual Studio to attach to a program that you want to debug on the remote computer, or start a program that you want to debug on the remote computer. For more information, see How to: Attach to a Running Process.

See Also

Tasks

Remote Debugging Errors and Troubleshooting

Concepts

Just-In-Time Debugging

Other Resources

Remote Debugging Setup