Tuesday, May 6, 2008

Remote Debugging

I've got an asp.net app running on a server, VS2008 running on my desktop, and I can attach the VS debugger to the w3wp.exe processes on the server. When you hit the website in the browser, the breakpoints in your local code just work. Here's how I set it up...
  1. I copied msvsmon.exe and msvsmon.exe.config to a folder on the server On my box, they were at "c:\program files\microsoft visual studio 9.0\common7\ide\remote debugger\x86" (There are x64 and ia64 folders as well)
  2. I launched msvsmon.exe on the server This creates a monitor called [myLoginName]@servername
  3. In the Tools-Permissions window, I added my regular login account as having debug rights (I have to log into the server as an admin account)
  4. On my dev box, in Visual Studio, I chose Debug-Attach to process
  5. I typed in [myAdminLoginName]@servername to match the name of the monitor
  6. I clicked the Refresh button, and voila! -- a list of processes
There's one downside. When I do step 3, then close msvsmon.exe, it doesn't remember that I added my account the permissions, so each time I run it I have to re-add the permission. Luckily remote debugging isn't something we do on a daily basis.

2 comments:

أحمد said...

Hi,

Our server is running on x64; I shared the (x86) folder for the remote debugger on the server and followed all steps till I saw the refreshed processes on the server in my x86 visual studio debugging windows for attach to process; however, when I attempt to attach a process, w3wp.exe of Type 64, it can't due to the machine architecture conflict; is it possible to debug from a x86 machine on target x64 remote machine?

Tom Puleo said...

I don't have any experience with the x64 servers, but it would seem to me that you could debug a 32-bit process remotely if was running in 32-bit mode on the server. I seem to remember there being a "program files" and a "program files (x86)" folder on the servers...something like that. Good luck figuring this out. If you find a solution, I'd love to know about it.