Just to be safe, when I make changes in the values of the appSettings in the Web.config I always restart the WebSite so all the changes can be refreshed. But do I really need to restart it? how is IIS handling the appSetting values, is it reading the values in one time (once you start the application) or is IIS reading it every time a client is accessing the website?
问题:
回答1:
Actually, it is not the "Website" but the "App Pool" that needs the restart. Remember the website pipeline in IIS has no "executable" code, just markup.
This is however treated as a "Per App Pool" setting by IIS. In your INETMGR, open the properties of any app pool and look for this setting: "Disable Recycling for Configuration Changes" (under the Recycling group of settings). If you set this to "True", then IIS will not monitor for config changes FOR THAT APP POOL's CONFIG FILES and will not restart the app pools if you edit/change something. However, that means you must manually recycle --- a valid scenario if you are updating the website and want to change the BIN folder and multiple .config files in the hierarchy. Left on its own, in the minimum condition of one web.config file, that's two app pool restarts.. one for the BIN changes and one for web.config.