Given the task of remotely debugging UAT code from my workstation, I read so many articles around steps to get it working. Though all of them contributed in getting it working, there was not a single silver bullet post which nailed the solution for me. The approach that worked for me was a concoction of tips and tricks from multiple posts. Let me chart out the steps I treaded to get there, hoping that for some it works as a one stop shop. Please note my IDE is VS 2005 Team Edition.
1) For remote debugging, a remote debugging monitor service msvsmon should be running on the remote machine. For 64bit processes, the service executable is available at <install path>\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x64.
2) Double click the executable on the remote machine which opens a window with a timestamp and a message “Msvsmon started a new server named <login name>@<remote machine name>. Waiting for new connections.” i.e. the service has been started. Please note that the <login name> would be the user with which you have logged onto the machine and maybe qualified with the name of the domain on which you are currently logged onto.
3) Build the solution on the host machine and place the assemblies along-with the .pdb files onto the remote machine file system. GAC these assemblies from the remote file system into the remote assembly cache.
4) Restart the appropriate service/ process so that it starts picking up our newly gaced assemblies. In my case it was the BizTalk service which I had to bounce.
5) On the host machine IDE menu, open Debug --> Attach to Process. Set Transport as “Default” and Qualifier as <login name>@<remote machine name> i.e. details shown in the msvsmon window. Please do not omit the domain name. You can simply copy paste the <login name> from the msvsmon window.
Hit [Refresh] to see processes hosted on the remote machine and attach to the required process.
6) In Step (5) if you get an error like,
Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named <login name>@<remote
machine name>'. A security package specific error occurred.
Check whether,
The <login name> is an admin on the remote machine or added as a remote user on the remote machine.
If yes then use the following work-around:
a) On the remote machine create a user “RemoteDebug” (any name would do) and add the user as a local administrator
b) On the host machine, also create a user “RemoteDebug” and add the user as a local administrator
c) On the remote machine run msvsmon service under RemoteDebug user by doing a “run as”
d) On the host machine IDE open Debug à Attach to Process. With Transport set as “Default” set Qualifier as RemoteDebug@<remote machine name>. Hit [Refresh] which will display all the processes hosted on the remote machine
e) Go back to the remote machine and exit the msvsmon service. Start the service again, but this time simply double click the executable and not do a run as. This will run the service under your login name.
f) Go to the host machine IDE and open Debug à Attach to Process. With Transport set as “Default” set Qualifier as <login name>@<remote machine name>. Hit [Refresh] and this should now display all the processes hosted on the remote machine.
Please note that if you try to debug by attaching the process in step (d), the debugging will not work as the IDE is run under your login name and not under RemoteDebug
Do not hesitate to drop me an e-mail with any particular observations you have had whilst trying to setup a remote debug environment. Enjoy!
0 comments:
Post a Comment