harbar.net component based software & platform hygiene

App Pool Recycler for SharePoint devs

Print | posted on Friday, April 06, 2007 1:56 AM

[Update 9th April 2007] A new build with new features is available at Application Pool Recycle Utility for SharePoint Developers.

 

If you are doing any substantial SharePoint development, chances are you are using iisapp.vbs to recycle your application pools. This script, introduced with W2K3 SP1, does a bunch of useful stuff and you've probably got a shortcut to it configured with the name of your app pool.

If you don't know about this, recycling the app pool, rather than doing an IISRESET is much quicker and often times is all you need. I'm not saying you don't sometimes need to bounce IIS!

Trouble with this approach is that you gotta configure them damn shortcuts, and that's just hassle when you've got a bunch of properly configured app pools (and you should have your dev box configured properly to target your intended deployment scenario).

It's even more hassle when you've got a ton of different boxes for customer projects, demos etc etc.

So ages ago I hacked together a VBS to ask me which one I wanted to recycle, but that wasn't very good either cos it involved typing. So I dusted off Visual Studio and knocked together a little tray applet to do the business.

It enumerates the app pools on your box and lets you right click 'em to bounce 'em! It's not that good, and it needs some more work...

But it does function, you can even turn on logging for recycle requests to prove it. Bear in mind that if the app pool hasn't spun up (and they don't when you start them in inetmgr, only when a request is made) it won't recycle and therefore won't get logged. In this scenario, I catch (and ignore) the exception.

Now, I am *not* a winforms kinda guy so I couldn't figure out how to make the UI play nice with the traynotify control, so it has a lame about box. Sorry about that. Goggle, err, I mean Live Search couldn't help me here after much valor, so if you know how to make my startup form go away without losing the VS designer integration, let me know!

The app is 100% managed code - well OK it's not cos System.DirectoryServices is a wrapped-wrapper for ADSI, but there's no shelling out to dodgy VBSs here. It requires .NET 2.0 and Windows Server 2003 SP1 (but you're running SP2 right?). Also it only works against the local IIS.

I may make it better, I may not. I'm toying with the idea of implementing all three operations - but if you've got identity "issues" you should be in inetmgr anyways. If w3wp.exe craps out after a recycle, that's not my dodgy code - it's your VM not having enough virtual memory, so there!

Download it here.