Setting up remote debugging on 2003 and 2008 server

For a long time I have wanted to be able to do this without it being a 2 day ordeal, or having to beg IT to open up some ports etc. Seems to me the last time I looked this was a lot harder than it is now. Has it gotten easier or did I just assume it was annoying and not really consider it? Not sure, but it has been a real life-saver on recent projects, especially SharePoint. Here are the links that got me up and running quickly.

  • Best one to start with talks you thru the basic setup requirements:

http://www.wictorwilen.se/Post/How-to-get-Remote-Debugging-work-properly.aspx

  • Another take on the same setup:

http://www.sharepointblogs.com/llowevad/archive/2008/04/10/remote-debugging-gac-d-assemblies-in-sharepoint.aspx

  • On 2003 and 2008 servers you can have multiple w3wp.exe processes running, how to know which one matches your app pool

http://blogs.thesitedoctor.co.uk/tim/2007/10/16/Identify+Which+Application+Pool+Is+Associated+With+Which+W3WPexe+Process.aspx

the above link refers to 2003 and before and makes use of cscript.exe, on 2008 you need a different script. Here is a sample batch file. It will list all the active worker processes along with their process id and app pool name.

   1: cd %systemroot%\system32\inetsrv 
   2: appcmd.exe list wp 
   3: Pause 
  • When you attach to a worker process for a long debug session, IIS may kill the process while you are debugging since, to its health monitor, it appears to not be responding. How to set IIS and your app pool to leave you alone and let you work.

http://msdn.microsoft.com/en-us/library/bb763108.aspx

  • The last thing you will most likely want is to have your current symbol files deployed to the server's GAC as well. The folders are hidden so this will make the process easier. You can copy the symbols from a share on your dev machine or build server or deploy them locally and then copy them from there. This last project I had three assemblies one each for Branding, Controls and Business Logic and one for Web Parts. This simple batch would deploy my symbol files each time I deployed to the server and I would be all set up to debug when I needed to.
   1: copy \\BUILD_SERVER\PROJECT_NAME.Branding\bin\Debug\PROJECT_NAME.Branding.pdb c:\windows\assembly\gac_msil\PROJECT_NAME.Branding\1.0.0.0__838b0bf4b15f93ce
   2: copy \\BUILD_SERVER\PROJECT_NAME.Controls\bin\Debug\PROJECT_NAME.Controls.pdb c:\windows\assembly\gac_msil\PROJECT_NAME.Controls\1.0.0.0__838b0bf4b15f93ce
   3: copy \\BUILD_SERVER\PROJECT_NAME.WebParts\bin\Debug\PROJECT_NAME.WebParts.pdb c:\windows\assembly\gac_msil\PROJECT_NAME.WebParts\1.0.0.0__838b0bf4b15f93ce
   4: pause 

 

 

© Copyright 2009 - Andreas Zenker

No Comments