IIS 6 application setup

If you’re programmatically attempting to setup an IIS website and you’re calling AppCreate but ending up with a blank Application name (AppFriendlyName) it could be for one of two reasons.

  1. You called Invoke AppCreate after the CommitChanges
  2. If you’ve done 1 but doing that means the virtual directory doesn’t get turned into an application then it might be because you’ve tried to specify some of the details of the application by hand.  I was trying to specify AppPoolId and AppRoot before calling AppCreate.  When I removed that bit of code the app got created correctly and with a sensible name.

That ought to teach me not to cobble together things from lots of web articles!

IIS App Pool users

This one is another thing I keep forgetting.  When you want to create a new App Pool in IIS you want to make it a member of the IIS_WPG Group.  That will prevent the App Pool from dying horribly whenever you browse a page when you’ve just set it up.  If it does that after it’s been working for a while you’ve got a different problem.

The error you might get when you’ve done this is a 503 AppOffline.