Just a quick tip — if you’re having problems with programmatically modifying your IIS sites configuration using the Microsoft.Web.Administration .NET API, and are currently banging your head against the desk because:
- ServerManager.Sites returns a completely different set of sites than what is visible in IIS Manager, or
- No matter how many times you call it, ServerManager.CommitChanges() does not seem to have any visible effect
… then make sure you’re referencing the correct Microsoft.Web.Administration.dll assembly.
What’s the difference? Except for the version number, the two asssemblies look identical, except one (18.104.22.168) only affects IIS Express. You must use v22.214.171.124 if you want to modify IIS. Watch out!