How to debug a remote process


(original blog entry)

Visual Studio supports remote debugging from one computer to another. When you are doing remote debugging, the host computer can be any platform that supports Visual Studio. The remote computer can be a 32-bit (, Windows 2000, Windows XP, or Windows Server 2003) or 64-bit (IA64, IA64 WOW mode, x64, or x64 WOW mode) platform.

Here is an example of a common case scenario: debugging a service on a remote server (e.g. the MyService):

Setting up the remote machine

  1. You must have the “Remote Debugging Monitor” (i.e. msvsmon.exe) application installed on your remote machine:
    • Visual Studio installs msvsmon.exe into one of these directories depending on your machine configuration:
      • Install path\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x86
      • Install path\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x64
      • Install path\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\ia64
    • You copy it into a local folder on the remote machine.
      • Make sure that you take the right one corresponding to the OS and hardware of the remote machine:
        • 32 bits OS => .. \x86
        • 64 bits OS on Intel Itanium CPU => ..\ia64
        • 64 bits OS on other than Itanium CPU => ..\x64
  2. Install the application you want to debug.
    • Make sure you have the same “PDB” files on the remote machine as on the local machine
    • Make sure that you have the code source corresponding to the PDB files deployed on both machines
  3. Launch the “Remote Debugging Monitor” application.
    • The important bit of information display by the application is the account name and machine name that must be used for the connection.
  4. Add permissions for the windows account used on the local machine to run Visual Studio.
    • Click on “Permissions …”
      • Add the required Windows user account (e.g. “jmorais”.
      • Make sure it has “Debug” access.
      • A warning popup window might be displayed, read the message and click “Yes”:

Debugging from the local machine

  1. Launch Visual Studio (2005/2008).
  2. Open the solution you want to debug
  3. In the menu “Debug”, Click on ‘Attach to process …”
    • Keep “Transport” as “Default”
    • In “Qualifier”, enter the connection value displayed by the “Remote Debugging Monitor” application (e.g. “{MyDomain}\{MyAccount}@{MyMachineName}”)
    • Select the type of debugging (usually “managed code”)
    • Select the process you want to debug
    • click “Attach”
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: