views:

35

answers:

2

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?

+1  A: 

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.

kbrimington
Write a windows service for the FileSystemWatcher. Using a FileSystemWatcher in ASP.net only shows that you do not understand what the lifecycle in ASP.net is like
citronas
Thanks, @citronas. That was, I had intended at least, my point about not being able to use it effectively in an ASP.NET scenario.
kbrimington
As not every ASP.NET hosting scenario makes installing a windows service an option, I hadn't recommended it.
kbrimington
+1  A: 

You can use the FileSystemWatcher class for this.

Mark Cidade