简体   繁体   English

web.config中的外部配置节是否已缓存?

[英]Are external config sections in web.config cached?

I have my own custom configuration section, like this 我有自己的自定义配置部分,例如

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

and I keep it in an external file like this 我将其保存在这样的外部文件中

<ConnectionStrings configSource="connections.config"/>

I know that web.config is cached, and when I change the config, IIS resets the cache and reread the config again after restart... 我知道web.config已缓存,当我更改配置时,IIS会重置缓存并在重新启动后再次重新读取配置...

But In my case, when I change my external config connections.config IIS doesn't restart the app because I set restartOnExternalChanges="false" . 但是就我而言,当我更改外部配置connections.config IIS时不会重新启动应用程序,因为我设置了restartOnExternalChanges="false"

Question: Is my external config cached as well? 问题:我的外部配置是否也被缓存? or IIS reads from it all the time when I use ConfigurationManager.GetSection("ConnectionStrings") ? 还是当我使用ConfigurationManager.GetSection("ConnectionStrings")时IIS始终从中读取信息?

Sure, it is cached as well. 当然,它也被缓存。 The API ConfigurationManager.GetSection provides read-only view of the underlying configuration settings. API ConfigurationManager.GetSection提供基础配置设置的只读视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM