参考:
http://www.cnblogs.com/sxw_cug/archive/2013/02/28/1785477.html
http://www.cnblogs.com/jiaxa/p/3326631.html?utm_source=tuicool
http://www.cnblogs.com/Gyoung/p/3590778.html
一、原来的web.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="CacheTimeInfo" value="30" />
<add key="CacheTimeNews" value="10" />
<add key="CacheTimeProduct" value="60" />
<add key="CacheTimeTrade" value="5" />
<add key="SiteName" value="中国叉叉网"/>
<add key="SiteDomain" value="chinaxx.com"/>
</appSettings>
<connectionStrings/>
<system.web>
<compilation debug="false">
</compilation>
<authentication mode="Windows" />
</system.web>
</configuration>
二(1/2)、现在的web.config文件
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings configSource="Config\AppSettings.config" />
<connectionStrings/>
<system.web>
<compilation debug="false">
</compilation>
<authentication mode="Windows" />
</system.web>
</configuration>
二(2/2)、现在的Config目录下的AppSettings.config文件
<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<add key="CacheTimeInfo" value="30" />
<add key="CacheTimeNews" value="10" />
<add key="CacheTimeProduct" value="60" />
<add key="CacheTimeTrade" value="5" />
<add key="SiteName" value="中国叉叉网"/>
<add key="SiteDomain" value="chinaxx.com"/>
</appSettings>
这样在程序中修改Config\AppSettings.config文件,就不会导致重启了。
在Web.Config文件中使用configSource,避免动态修改web.config导致asp.net重启
原文:http://www.cnblogs.com/zfanlong1314/p/4456309.html