开发者

Dynamically reading app.settings in asp.net

开发者 https://www.devze.com 2023-01-11 06:39 出处:网络
开发者_StackOverflow中文版I\'ve moved my appsettings section outside of the web.config using: <appSettings configSource=\"AppSettings.config\"/>

开发者_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.

0

精彩评论

暂无评论...
验证码 换一张
取 消