Iis – Could you tell me what exactly happens when we edit the Web.config (at runtime) on a IIS server

iisweb.config

Could you tell me what exactly happens when we edit the Web.config (at runtime) on a IIS server.

Is the application that depend of the web.config automatically restarted? If yes is it possible to cancel the automatic restart (or reload of the web.config)?

Best Answer

The ASP.NET AppDomain is restarted whenever you 'touch' web.config. It's possible to turn off the File Change Notification (FCN) for a folder, but it's usually not the best bet if you can help it. If you do turn it off, it just means that you need to manually recycle the app pool for changes to take effect.

Prior to IIS7, only ASP.NET changes would cause the AppDomain recycle, but with IIS7 and many of the settings living in web.config, this is a more common issue. i.e. changing a default doc in IIS 7 Manager will cause that AppDomain recycle now.

Ideally you just need to keep your change rate down, or sometimes apply the change to applicationHost.config (which doesn't cause the AppDomain recycle) rather than web.config.