User2134761932 posted
So even if the ServerManager is cached somewhen this problem may arise - in worst case on the Finalizer Thread. So our first try will be replacing calls to ServerManager.GetApplicationHostConfiguration() with this code:
public static Configuration GetDetachedConfiguration( this ServerManager serverManager )
{
// Attach to the configuration file
var iisConfiguration = serverManager.GetApplicationHostConfiguration();
// Detach from notifications
iisConfiguration.SetMetadata( "changeHandler", null );
// Report result
return iisConfiguration;
}
Although I would be happy to hear of any better solution. In my personal opinion the COM wrapping as implemented is no relyable considering the described issue.
Jochen