Debugging your code using Visual Studio is an easy and useful thing to do, until you have to do it remotely, then its not so obvious what is required. After a lot of trial and error working around network access and firewalls etc these are the steps I took to get remote debugging working (using Visual Studio 2008).
For brevity the machine running Visual Studio shall be referred to as the source and the machine running the application shall be referred to as the target.
On both the source and target:
- The ‘Sharing & Security model for local account’ should be set to ‘Classic – Local users authenticate as themselves’. This can be found under Control Panel/Administrative Tools/Local Policies/Security Options/Network Access.
On the source machine:
- Run Visual Studio as the same username/password as you the target is running as, i.e. if the target is running as admin/password then Visual Studio needs to be running as a user name of admin with the password ‘password’.
- Build the source code in Debug.
- Copy the dll’s and pdb’s to the application folder on the target.
- Disable the firewall if neccessary.
- Run the Remote Debugger and set the options to ‘Windows Authentication’. The remote debugger can be found in the Visual Studio install location at Microsoft Visual Studio 9.0\Common7\IDE\Remove Debugger\x86.
- In Visual Studio select Debug/Attach to Process.
- In the ‘Qualifier’ dropdown type the target machine name.
- Select the application process name to debug.