Dynamically reading app.settings in asp.net
开发者_StackOverflow中文版I've moved my appsettings section outside of the web.config using:
<appSettings configSource="AppSettings.config"/>
This allows me to change my appsettings without actually restarting IIS.
I know however, that IIS monitors all configuration files constantly. How can I attach to event my-appsetting-has-changed to take some custom action upon that?
According to this reference and this reference,
[The] ASP.Net runtime does not detect when the external [config] file changes.
If that's true, then you might get some mileage out of the FileSystemWatcher
, but I cannot think how to use that effectively in an ASP.NET scenario.
I hope this helps.
You can use the FileSystemWatcher
class for this.
精彩评论