Udostępnij za pośrednictwem


Debugging Browser Forms: Determine the right w3wp.exe

Last week, we posted an article on techniques around debugging browser forms. We received a few questions around the recommended way to find the right w3wp.exe process to attach to - this article aims to help.

Non-production Server (where you can do anything without users complaining about service availability)

It is good idea to use Visual Studio to debug W3WP.exe. It is easier than using WinDbg but way more heavy weight to install. In any case make sure you have proper symbols servers configured properly or have PDB files for your code handy.

  • The easiest approach is to attach to all worker processes at the same time. Both Visual Studio and WinDbg support this.
    To do so, go to "Attach to process" (available in "Tools" menu for VS, "File" menu for WinDbg) and attach to all W3WP processes. Breaking into debugger (on breakpoint or exception) will affect all sites. Users likely to get timeouts or other forms of "service unavailable" responses; make sure noone loses their data while you are debugging.
  • Run IISreset and then execute single request to site you want to debug. It is very likely that there will be only one W3WP started at this point.

Options for production servers apply to non-production servers, too, but not vice versa :-).

Production Server

You are likely will be limited to grabbing stack trace/full memory dump at the moment of exception using WinDbg. You still need process ID; here are 2 way to get it without hurting the server.

1) Use %windir%system32iisapp.vbs to get process IDs of W3WP processes. Note that it might be not trivial to figure out what W3WP to attach to if AppPool is configured as Web Garden or non-default option (new App Pool with port as part of app pool name) was chosen when Web Application was created.

2) Look into WSS logs (...web server extensions12logs) for recent entry related to W3WP. Even better, just look for failure trace in the log file and second column is process ID to debug. Note that it could be good idea to bump logging level to Verbose to some or all categories related for Forms Server on "Central Administration" -> "Operations" -> "Diagnostic Logging" page.

Alexei Levenkov
Software Design Engineer

Comments

  • Anonymous
    November 29, 2006
    The comment has been removed