Do you accept the hit disk every time you retrieve the value of web.config?

I very often call the following line of code:

var configValue = System.Configuration.ConfigurationManager.AppSettings["ConfigValueKey"]; 

Am I taking a disk insert for ASP.Net to retrieve an element from web.config, or is it smart enough to cache a value in memory and only update the cache when web.config changes?

+3
source share
2 answers

The configuration data is stored in memory. However, ASP.NET will keep track of changes to web.config and recycle the application domain if the file has been modified.

In addition, all user sessions will be lost, so it is not recommended to touch web.config while the application is running.

+5

, .

+7

Source: https://habr.com/ru/post/1735441/


All Articles