New API to avoid restarting IIS when you add a new app pool (Windows Server 2008, RC0)
One of the things we worked hard on in IIS7 was eliminating unnecessary restarts of IIS in daily operations of the Web server. In the recent RC0 release of Windows Server 2008 RC0, we added an API for folks who want to automate flushing the token cache on IIS7. This might be something that you would want to do if you change settings that would change properties of the token after it is cached. Before RC0, that would require restarting IIS. With this new API, you can automate flushing the token cache without restarting IIS7.
Here's a sample for how to use the new API:
var adminManager = new ActiveXObject( "Microsoft.ApplicationHost.AdminManager" );
var appPoolsElement = adminManager.GetAdminSection( "system.applicationHost/applicationPools", "MACHINE/WEBROOT/APPHOST" );var defaults = appPoolsElement.ChildElements.Item("applicationPoolsControl");
var flush = defaults.Methods.Item("FlushTokenCache").CreateInstance();flush.Execute();