Reputation: 15827
When creating a webapplication we get a web.config file, if we edit this config file the webapplication will restart.
There is a way to reference another config file in .NET but will this solve the problem?
<appSettings configSource="Config\AppSettings.config"/>
Upvotes: 0
Views: 903
Reputation: 6924
Consider storing (some) settings in a database instead of web.config.
Upvotes: 0
Reputation: 6814
The appSettings key supports two attributes for external configuration: file and configSource (inherited)
<appSettings file="AppSettings.config" />
<appSettings configSource="AppSettings.config" />
In both cases changing the external file does not restart the worker process, see http://msdn.microsoft.com/en-us/library/ms228154(v=vs.100).aspx and http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.configsource.aspx (for configSource there is a RestartOnExternalChanges property that forces a restart on change)
Read more at Changing AppSetting does not have effect on Application and Is web.config or app.config cached in memory
To access the settings use
WebConfigurationManager.AppSettings["key_name"]
Upvotes: 1
Reputation: 226
1) if you phsically change web.config then service will restart, but if you change programmatically then it will not restart, so you needn't have another web.config, you can do it programmatically. 2) You can read here 3) It is cached, read one time in application start event
Upvotes: 0