Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 634
MattH Avatar asked Nov 06 '22 19:11

MattH


1 Answers

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" />
like image 176
gnfontaine Avatar answered Nov 15 '22 12:11

gnfontaine