Sunday, May 25, 2008

How to set up and use remote debugging in Visual Studio .NET?

The Remote Debugging Monitor (Msvsmon.exe) is a small application that Visual Studio 2005 connects to for remote debugging. During remote debugging, Visual Studio 2005 runs on one computer (the debugger host) and the Remote Debugging Monitor runs on the remote computer along with the application you are debugging.

The Remote Debugging Monitor runs as a Microsoft Windows application. The user interface shows that the Remote Debugging Monitor is running and makes remote debugging easy to set up.

Let's consider an example to understand this situation clearly. Molly Clark and Adam Barr are both employees at Adventure Works. Adventure Works has a Microsoft Windows NT domain named adventure-works.com. Adam is having trouble with some software that Molly wrote. Molly would like to debug this software on Adam's computer. Molly and Adam follow these steps:
  1. Adam doesn't have the remote debugger on his computer. To set up the remote debugger, Molly decides to share out the Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger directory on her computer. She creates a file share called Remote.
  2. Adam runs \\MollyComputerName\Remote\x86\Msvsmon.exe.
  3. After the remote debugger starts, Adam clicks Permissions on the Tools menu to configure the remote debugger by using the Permissions dialog box. He gives Molly permission to debug.
  4. Note: Adam could also configure the remote debugger by passing the /allow option when the remote debugger starts.
  5. Molly starts Visual Studio 2005.
  6. To open the Attach to Process dialog box, Molly clicks Attach to Process on the Tools menu.
  7. Molly connects to Adam's computer by entering adventure-works.com\Adam@AdamComputerName in the Qualifier box.
  8. Under Available Processes, Molly selects the worker process that her application is using and then clicks Attach.
  9. Molly opens a browser and provides the URL to the remote application. The execution stops where the breakpoint is placed in the application.
Citation:
http://support.microsoft.com/kb/910448
http://support.microsoft.com/kb/318041