dchase5464
06-27-2006, 01:43 PM
For a web app, I need to be able to update the web.config's <system.diagnostics> section on the fly without restarting the app (and losing Session info, booting users off, etc.). I've got it all working by moving the section to an external file (with configSource) and editing the machine.config so that system.diagnostics has restartOnExternalChanges="false". I can detect an update and programmatically refresh the settings (using Trace.Refresh) without restarting the app. Great.
However, I'd rather not have to fool around with machine.config in every dev, qa, staging & production environment. I'm particularly concerned with issues arising if we move the site to a shared web host (it's currently internally hosted), since I assume I won't be able to get machine.config customized in a shared environment.
I've tried to reset the system.diagnotics section setttings by including this at the top of my web.config (instead of editing machine.config):
<configSections>
<remove name="system.diagnostics"/>
<section name="system.diagnostics"
type="System.Diagnostics.SystemDiagnosticsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
restartOnExternalChanges="false" />
</configSections>
I get a compilation error though: "Section or group name 'system.diagnostics' is already defined. Updates to this may only occur at the configuration level where it is defined."
Am I doing something wrong? If I can't override restartOnExternalChanges, what's the best alternative?
Thanks, David
However, I'd rather not have to fool around with machine.config in every dev, qa, staging & production environment. I'm particularly concerned with issues arising if we move the site to a shared web host (it's currently internally hosted), since I assume I won't be able to get machine.config customized in a shared environment.
I've tried to reset the system.diagnotics section setttings by including this at the top of my web.config (instead of editing machine.config):
<configSections>
<remove name="system.diagnostics"/>
<section name="system.diagnostics"
type="System.Diagnostics.SystemDiagnosticsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
restartOnExternalChanges="false" />
</configSections>
I get a compilation error though: "Section or group name 'system.diagnostics' is already defined. Updates to this may only occur at the configuration level where it is defined."
Am I doing something wrong? If I can't override restartOnExternalChanges, what's the best alternative?
Thanks, David