简体   繁体   中英

Using configSource, and changing restartOnExternalChanges for core section

I'd like to use the configSource attribute of my web config section to define external files for various settings.

Particularly, the appSettings section. This means my config file has the following entry:

<appSettings configSource="My.AppSettings.config" />

However, if this file is updated, the settings are not automatically picked up, which would have been the case if the settings were manually included in the web.config

Further investigation lead me to the restartOnExternalChanges attribute. This can apparently be used with <section/> elements to define whether externals files identified by configSource can trigger restarts or not. Great! or so I thought.

However, when trying to define the appSettings section, and changing the restartOnExternalChanges value, I see the same error encountered here , because the appSettings section is defined in the machine.config - a file I cannot change.

Does anyone know if its possible to get these two settings to work together, for sections already defined at a higher-level?

Try this configuration instead.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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