How to: Set Up Remote Debugging

This topic applies to:

Edition

Visual Basic

C#

F#

C++

Web Developer

Express

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

Pro, Premium, and Ultimate

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

To enable remote debugging, you install or share remote debugging components on the remote computer that contains the application to be debugged. If your computers are protected by a firewall, you must take extra steps to enable communication between the remote computer and the computer that is hosting Visual Studio. You must also ensure that the debugger can locate the symbol files for the process to be debugged and that you have the correct permissions to access the process to be debugged.

Note

Both Visual Studio and the remote debugging components contain routines to automatically configure the firewalls of the computers. When you start remote debugging for the first time, Visual Studio should perform the necessary configuration on the Visual Studio host computer. When you run the Remote Debugging Monitor on a remote computer for the first time, the Remote Debugging Monitor should configure the Windows Firewall on that end. However, this functionality might not work because of the complexities of your firewall configuration. We recommend that you use the procedures described in the topics listed in the Configuring the Firewalls section to make sure that the programs and ports are allowed through the firewall.

In This Topic

This topic contains the following sections:

Set Up Permissions

Locating Symbol Files

Set Up the Visual Studio Host Computer

Set Up the Remote Computer

Configure the Firewalls

Set up Permissions

Warning

Remote debugging is a highly privileged operation, sometimes requiring sysadmin privileges on the Visual Studio host and the remote computer. Review the information in the Debugger Security topic for best practices in remote debugging.

The following permissions are required for remote debugging:

Native Debugging

To debug a process that is running under your account and password: No special permission is needed.

To debug a process that is running under another account name: Your Windows login account has to be a member of the system administrators group on the remote computer.

Managed Debugging

To debug a process that is running under your account and password: No special permission is needed.

To debug a process that is running under another account name: You must have administrator privilege on the remote computer. If the ASP.NET worker process aspnet_wp.exe is running as SYSTEM or ASPNET, for example, you have to be an administrator on the computer where that process is running.

Processes that host the common language runtime, such as SQL Server 2005, may enforce custom debugging privileges.

For information about the permissions needed to debug Transact-SQL, see How to: Enable Transact-SQL Debugging

Locating Symbol (.pdb) Files

Symbol files contain the debugging information for compiled executables. The symbol files of the application to be debugged must be the files that were created when the application executables were compiled. The symbol files must also be located where the debugger can find them.

  • The symbol files for native applications must be located on the Visual Studio host computer.

  • The symbol files for managed applications must be located on the remote computer.

  • The symbol files for mixed (managed and native) applications must be located on both the Visual Studio host computer and the remote computer.

For more information, see Managing Symbols and Source Code.

Set Up the Visual Studio Host Computer

If the Visual Studio host computer is protected by a firewall, you must configure the firewall to allow Visual Studio to communicate with the remote computer. If your network requires that communication be performed using IPSec, you must open additional ports in the firewall. The procedures that you use to configure your firewall depend on the version of the Windows operating system. For more information, see the topics listed in the Configure the Firewalls section.

If the Visual Studio host computer is not protected by a firewall, no additional steps are necessary.

Ports to open on the Visual Studio computer to enable remote debugging

Ports

Protocol

Description

135

TCP

Required

500, 4500

UDP

Required if your domain policy requires network communication to be performed through IPSec.

Set Up the Remote Computer

To enable remote debugging, you can either:

  • Install the remote debugging components on the remote computer and launch the Remote Debugging Monitor (msvsmon.exe) when you start debugging- or -

  • Run the Remote Debugging Monitor remotely from a share.

If the remote computer is protected by a firewall, you must configure the firewall to allow the Remote Debugging Monitor to communicate with the Visual Studio host computer.

  • If your network requires that communication be performed using IPSec, you must open additional ports in the firewall.

  • If you are debugging a process on a web server, you must open an additional port.

The procedures that you use to configure your firewall depend on the version of the Windows operating system. For more information, see the topics listed in the Configure the Firewalls section.

Ports on the remote computer to open to enable remote debugging

Ports

Protocol

Description

135, 139, 445

TCP

Required

137, 138

UDP

Required

500, 4500

UDP

Required if your domain policy requires network communication to be performed through IPSec.

80

TCP

Required for Web Server debugging.

Limitations of sharing remote debugging components

Although running the Remote Debugging Monitor from a file share is the easiest way to enable remote debugging, this method has the following limitations:

  • The Remote Debugging Monitor cannot run as a service from a share on the remote computer. You must install the remote debugging components as a service if you want to do either of the following tasks:

    • Start an ASP.NET web application with debugging from Visual Studio.

    • Step into a hosted serviced called from a WCF client.

    However, you can attach the debugger to ASP.NET web applications and to WCF services.

  • If Visual Studio is installed on a 32-bit computer, only the 32-bit version of the Remote Debugging Monitor is installed. In this case, you must install the remote debugging components if you want to debug a 64-bit application on the remote computer.

Installing the remote debugging components

You can run or download the Microsoft Visual Studio 2010 Remote Debugger setup program from the Microsoft download center. The setup program is also available on the Visual Studio installation media in the vs\Remote Debugger folder. Choose the setup program that matches the operating system (x86, x64, ia64) on the remote computer.

After the setup program runs, the Visual Studio Remote Debugger Configuration Wizard is launched.

  1. On the second page of the wizard, you can choose to run the remote debugger as a service. You can also specify credentials for the service.

  2. On the third page of the wizard, you can select the network locations that can communicate with the remote debugger through the Windows firewall.

Note

Because of the complexities of Windows firewall configuration, the wizard might not set the appropriate program and port exceptions for the firewall. To make sure that the configuration is complete, we strongly encourage you to follow the procedures described in Configure the Firewalls .

The remote debugging components are installed on the remote computer in the

  • C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger folder on x64 computers.

  • C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger folder on x86 computers.

Running the remote debugging components from a share

The remote debugging components are installed on the Visual Studio computer in the

  • C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger folder on x64 computers.

  • C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger folder on x86 computers.

Use the procedures described in Configure the Firewalls to enable the program and ports of the remote debugging monitor to communicate with the Visual Studio computer.

Configure the Firewalls

The following table provides links to topics that describe how to configure the firewalls on specific operating systems for both the Visual Studio host and remote computers. Although the programs and ports that are opened are the same for all versions of the operating system, the procedures vary. Choose the topics that match the operating system of the computer.

Operating system

Configuration topic

Windows 7Windows Server 2008Windows Server 2008 R2

How to: Configure the Windows 7 Firewall for Remote Debugging

Windows Vista Service Pack 2

How to: Configure the Windows Vista Firewall for Remote Debugging

Windows XP Service Pack 3Windows Server 2003 SP3

How to: Configure the Windows XP Firewall for Remote Debugging

See Also

Other Resources

Remote Debugging Setup

Debug Settings and Preparation

Change History

Date

History

Reason

June 2011

Because of a significant number of issues with the remote debugging automatic configuration, this topic was extensively rewritten to emphasize manual configuration and simplify procedures.

Customer feedback.