asp.net configSource behavior

If I use this construct in my asp.net web.config file

  <appSettings configSource="MyAppSettings.config"/>

1) How and when do changes to values in the MyAppSettings.config file take effect?
2) And in particular, are such configSource files initially cached and then re-cached after being changed, or does accessing the appsetting values in them require disk hits?

This affects a design decision in the case where the appsettings value will be frequently accessed. If they require disk hits, then maybe the appsetting values should be replicated in application memory (and refreshed as needed).
LVL 2
codequestAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy DownsOWNERCommented:
Maybe this will help.

a way of changing the value of configSource during applcation start in the global.asax. I check an appsettings envirnoment variable that I set on the machine and if the config file for the connections is not the one for that environment, I replace the name with env & ".config". Now, this actually works quite well with one distinction. I have been specifying default.config as the file name. It contains simply <connectionstrings />. Each of the applcation config's all have full sets of strings.

solution was to stream the target config include file for the custom section to a string, save the new configSource value, SetRawXml() on the custom section object with the streamed string, save those changes, then refresh the section
.

Its important to note that when reading the new section, you must ensure the app reads from disk rather than cache by calling OpenExeConfiguration() or OpenMappedExeConfiguration() on the ConfigurationManager instance, then calling GetSection() on the returned object.

Using ConfigurationManager.GetSection() will pull the section from memory, regardless of the RefreshSection() call you had previously made.
codequestAuthor Commented:
Thanks, looks potentially useful;  I'll take a closer look later.
codequestAuthor Commented:
I tested the results, published here:

http://forums.asp.net/p/2051097/5915095.aspx?Re+asp+net+configSource+behavior

Looks like configSource settings are cached within a very short time after being updated.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
codequestAuthor Commented:
I answered the question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.