Should I put custom AppSettings web.config data into the ApplicationState?
I've got some custom values in the AppSettings, in my web.config file.
The开发者_StackOverflowse values get checked upon every Request. (Please ignore the fact that this might be a bad/good thing .. that's out of scope of the question).
eg.
So if every request checks the web.config file for the value of this key, would be be smart to put this into the Application cache (eg. via the global.asax) instead of checking this value EVERY request?
I'm assuming that when we read a value from the AppSettings, the website does a physical read of the web.config file? or is this information also all read into Memory when the website starts up and all references to any appSettings information is just an inmemory read .. not a disk I/O read?
The WebConfig is cached. Just at the first request of the website does a physical read. All the others requests use the cache data. This is why when you change the web.config file and call a request your site will have a little delay, because the information in web.config is being recached.
There's no need to do anything:
http://weblogs.asp.net/stevewellens/archive/2011/01/15/web-config-is-cached.aspx
精彩评论