Using the Visual Studio 2010 Remote Debugger with ASP.NET MVC

Visual Studio Remote Debugging Monitor

To use the remote debugger with ASP.NET MVC applications, you first must run the Visual Studio Remote Debugger Monitor on the server or remote computer.

There are two ways you can do this:

– Copy the monitor’s files to the server or remote computer
– Create a shared folder on your developer client and run the monitor on the server from the share.

I will go through the shared folder method. Share out this folder:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger

If you server is running a 64-bit OS, use the x64 folder.  For the 32-bit OS, use the x86 folder.

Setting up the server

– Log into the server and navigate to the shared folder on your developer PC. 
– Go into the correct folder for your server’s OS (x86 or x64).
– Run the msvsmon.exe file.  If your server’s OS is Windows 2008, you will need to right-click on the file and run as Administrator.
– Open Tools -> Permissions.  Make sure that your developer client user is listed here.  If not, add the user and click OK.  Click Yes to allow the user to debug.
– Copy the name of the server (listed on the first line of the Visual Studio Remote Debugging Monitor).
– Return to your developer client.

Debugging remotely

– Make sure the latest version of your application is published to the server (so your source code will be the same as the executed code).
– From Visual Studio 2010, click Debug -> Attach to process.
– Change the value of the Qualifier field to the name of the server on the Visual Studio Remote Debugging Monitor and click Refresh.
– Under the Available Processes, select “w3wp.exe” and click Attach.  If you do not see this process listed, then open a web browser and run your application.  After your application has loaded, click the Refresh button and you should see the process.

* If you receive any error messages, you may need to:
– Click Build -> Clean Solution
– Click Build -> Rebuild Solution
– Republish your application to the server
– Click Debug -> Attach To Process

You may also like...

3 Responses

  1. My search ends here. Thanks for the great tip.

  2. Jake says:

    Remote debugging is a great tool to have in your bag – thanks for the great tutorial – simple and easy to follow.

  3. Fábio says:

    One complementary tip: Since in my server there are various virtual directories and web sites running I normaly go to the command windows and type “iisapp” to search for the right Process ID to attach.

Leave a Reply

Your email address will not be published. Required fields are marked *