在更改web.config的appSettings中的值时,在IIS中重新启动网站 [英] restart website in IIS when changing values in the appSettings of the web.config

查看:472
本文介绍了在更改web.config的appSettings中的值时,在IIS中重新启动网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了安全起见,当我在Web.config中更改appSettings的值时,我总是重新启动WebSite,以便可以刷新所有更改。但我真的需要重新启动吗? IIS如何处理appSetting值,是一次读取值(一旦启动应用程序),或者每次客户端访问网站时IIS是否读取它?

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?

推荐答案

实际上,它不是网站,而是需要重启的应用程序池。请记住,IIS中的网站管道没有可执行代码,只是标记。

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.

然而,这被IIS视为每个应用程序池设置。在INETMGR中,打开任何应用程序池的属性并查找此设置:禁用回收以进行配置更改(在回收组设置下)。如果将其设置为True,则IIS将不会监视配置更改以获取APP POOL的CONFIG FILES,并且如果您编辑/更改某些内容,则不会重新启动应用程序池。但是,这意味着如果要更新网站并希望更改层次结构中的BIN文件夹和多个.config文件,则必须手动回收---有效方案。在一个web.config文件的最小条件下,它自己离开,这是两个应用程序池重新启动..一个用于BIN更改,另一个用于web.config。

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.

这篇关于在更改web.config的appSettings中的值时,在IIS中重新启动网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆