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 (188.8.131.52) only affects IIS Express. You must use v184.108.40.206 if you want to modify IIS. Watch out!September 22, 2013