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)?

link|improve this question
You could try turning on file access auditing to see whether or not IIS reads the web.config after you modify it. – Eric H Nov 1 '09 at 12:10
feedback

3 Answers

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.

link|improve this answer
feedback

The application that uses the web.config will restart when you change it, there's more info here:

http://msdn.microsoft.com/en-us/library/ms178473.aspx

I don't know of any way to prevent this from happening (and I'm not sure why you'd want to - perhaps you can provide some more details of what you're trying to achieve).

link|improve this answer
feedback

FYI - In ASP.NET 2.0 you can use the built in Health Monitoring Events to log application restarts along with the reason for the restart. This will enable you to clearly document when and how often it occurs. This is accomplished by editing the master web.config for the machine.

For more information:

http://blogs.msdn.com/tess/archive/2006/08/02/asp-net-case-study-lost-session-variables-and-appdomain-recycles.aspx

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.