【问题标题】:Are external config sections in web.config cached?web.config 中的外部配置部分是否缓存?
【发布时间】:2016-11-23 05:33:32
【问题描述】:

我有自己的自定义配置部分,像这样

<configSections>
   <section name="ConnectionStrings"
            type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            restartOnExternalChanges="false"
            requirePermission="false" />
</configSections>

我把它保存在这样的外部文件中

<ConnectionStrings configSource="connections.config"/>

我知道web.config被缓存了,当我更改配置时,IIS会重置缓存并在重启后再次重新读取配置...

但就我而言,当我更改外部配置 connections.config 时,IIS 不会重新启动应用程序,因为我设置了 restartOnExternalChanges="false"

问题:我的外部配置是否也被缓存了?或者当我使用ConfigurationManager.GetSection("ConnectionStrings") 时,IIS 一直从它读取?

【问题讨论】:

    标签: c# asp.net wcf iis web-config


    【解决方案1】:

    当然,它也被缓存了。 API ConfigurationManager.GetSection 提供底层配置设置的只读视图。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-19
      • 2012-11-29
      • 2011-02-19
      • 1970-01-01
      • 2011-05-27
      • 2013-03-31
      • 1970-01-01
      相关资源
      最近更新 更多