Scott Guthrie posts a trick on a quick way to kill a process on your system, or kill and restart an ASP.NET or IIS worker process. I tried to post a comment on his trick, but the commenting system is not working. So I’ll give my opinion here, leaving me with a bit more room to elaborate.
Scott’s suggesting that you use taskkill to kill a process running the application pool. That’s all nice and neat, but how do you know what process to kill? If you have multiple application pools, you might just kill the wrong one. A much better solution is to use the little known iisapp command. In fact, iisapp is a vb-script located in %winnt%\system32. Run it from the command prompt without parameters, and you get a list of application pools with their associated process ids.
W3WP.exe PID: 3328 AppPoolId: DefaultAppPool
W3WP.exe PID: 232 AppPoolId: AppPool ASPNET2.0
The command IIsApp /a DefaultAppPool /r will recycle the specified application pool. Not only is this a lot easier, it’s less error prone, thus safer to use. What if you kill the wrong process? I.e. by mistyping or by the fact that after you listed your processes, the application pool has recycled already.
There are a few other commands that few are aware of. E.g.
This will give you a list of configured websites, their status, port number and hostheader. You can also use iisweb to create, pause, stop, start and delete websites. iisvdir will do something similar for virtual folders.
With iisback you can backup and restore the IIS configuration. In fact, if you do a listing of .vbs-files from within %winnt%\system32 you may find some other hidden gems.
Hope this helps… too.