Remote Debugging with Visual Studio 2010
On occasion I find myself needing to debug an application I've written on another box. Last week I finally took the time to figure out how to get the Visual Studio Remote Debugger working. I must have been doing something wrong all the previous times I tried to get it to work because this time it 'just worked'!
Read on for details.
References:
- Remote Debugging Setup [msdn.microsoft.com]
- Just-In-Time Debugging [msdn.microsoft.com]
- How to: Set Up Windows Authentication Mode [msdn.microsoft.com]
- How to: Set Up Remote Debugging [msdn.microsoft.com]
- Remote Debugging Across Domains [msdn.microsoft.com]
- Download: Microsoft Visual Studio 2010 Remote Debugger [microsoft.com]
Steps I used to get remote C# debugging to work
Common Setup
- Make sure the Firewall is setup on both machines to allow traffic for the remote debugger
- Ensure that you are logged into both your development machine and the remote box with the same username and password or the debugger won't be able to connect
Remote Machine
- Download the VS 2010 Remote Debugger and install it
- Start running the Remote Debugger (accept all the default options when prompted)
- Copy the PDB (Symbols) files for your binaries from your development box to the remote box where it is running. Place the PDB files in the same directory as your running program. In my case I only had one PDB file so I placed it by the exe.
Dev Box
- On your development box, open up your Solution or Project file in Visual Studio 2010
- Go to the Debugger Menu and select Attach to Process
- Inside there change the computer name that shows up in one of the text bars at the top of the screen to the IP Address of the remote machine you want to connect to.
- Press the Refresh button, now you should see the processes on the remote box
- Select the process that corresponds with your application
And that's it: now you are debugging the program running on the remote machine!