web.config 中的外部配置部分是否已缓存?
Are external config sections in web.config cached?
我有自己的自定义配置部分,像这样
<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"
.
问题:我的外部配置也被缓存了吗?或者 IIS 在我使用 ConfigurationManager.GetSection("ConnectionStrings")
?
时一直从中读取
当然,它也被缓存了。 API ConfigurationManager.GetSection
提供底层配置设置的只读视图。
我有自己的自定义配置部分,像这样
<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"
.
问题:我的外部配置也被缓存了吗?或者 IIS 在我使用 ConfigurationManager.GetSection("ConnectionStrings")
?
当然,它也被缓存了。 API ConfigurationManager.GetSection
提供底层配置设置的只读视图。