0

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?

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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
Thanks, @citronas. That was, I had intended at least, my point about not being able to use it effectively in an ASP.NET scenario.
As not every ASP.NET hosting scenario makes installing a windows service an option, I hadn't recommended it.
1

You can use the FileSystemWatcher class for this.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.