Saturday, June 30, 2007

Which W3WP.EXE to Debug ?

Here is the scenario. Some Web Service program runs in IIS 6.0 having cryptic error, and you have to figured it out using MS Visual Studio 2003 debugger. As you may all already know, to debug some Web Application Process in remote computer, you have to debug process that is resides in W3WP.EXE.

Well, after you fire out the Debug Process screen, to your dismay, you found more than one W3WP.EXE with different Process ID. The question is, which W3WP.EXE to be the debugger attached to ?



You can find it using command line utility called IISApp :



The AppPoolId refers to the Application Pool where your web application resides. Usually it resides in DefaultAppPool. To verify that your application is indeed resides in certain Application Pool, you can use IIS Manager 6.0 snap in :



In the above example, the gear below the "DefaultAppPool" is all of the web application that resides in that particular Application Pool.

After determining which application pool that your web application resides, you can write down the PID shown by IISApp, and perform the right choose, and hence, your debugger will break to your desired location.

Whereas about precisely how you do the debugging, you can consult another posting in this blog. Wish you a happy web service debugging :) !

How to Do Web Service Debug in Remote Computer (Visual Studio 2003) ?

This works on MS Visual Studio 2003, and assuming that the remote server is running the IIS 6.0.

First, find W3WP.EXE process that is associated with that Web Service, if there are many W3WP.EXE in the process list, you can find it using the IISAPP command line. If you don't know how to to it, you can find it in another article in my blog :)

Please note that the "SPS" in this screen refers to the Remote Computer name. You have to be member of Debugger Users in that remote computer, if successful, the process on the Remote Computer will be displayed as shown :



What if instead an error message is show up ? Well, no problem, that is already solved in yet another article in this blog :)

Next, set the Project that contanis the Web Service as default, then using the Break to the Web Service Method that will be debug. You have to type the method completely (i.e. start from outermost parent, such as Aaaa.Bbbb.MethodName and case sensitively. Sorry, I can't show you exact function name in this screen because of the proprietary nature of this application. You can inquire more about this using comment that is is provided in this blog.



Run application (using your favorite web browser) that use that Web Service Method, and you're done :)





Friday, June 29, 2007

Which Service that is Hosted by SVCHOST.EXE ?

If you view the tasklist using MS Windows 2003, you would seeing typical screen like this :












To show which service that is hosted by SVCHOST.EXE, you can use the /svc in the tasklist command line as shown in this picture :