Cost of using web.config

  • Thread starter Thread starter John Bailo
  • Start date Start date
J

John Bailo

What's the cost of using a web.config key in a web method?

Is the value cached at start up? Or at first run? Or read on each
access?

Is web.config always "read off the disk" or can the file be cached?


I'm debating putting in a AppSetting[] entry versus hard coding for a
web service handling many hundreds of requests per hour.
 
The web.config is read at app startup and everything in it is cached.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Orange you bland I stopped splaying bananas?
 
In Addition, if you change web.config, the web application will restart
automatically to get the changes.
 
Kevin,

I could be mixing things up a bit here - I rememebr something about
AppSetting values are not cached and the AppSetting collection is read in
its entirety each time you request a value from it. So, read it once and
stick it in the app object if you want it cached.

Has it changed with 2.0 or am I wrong about it anyway?

--
--
Regards

John Timney (MVP)


Kevin Spencer said:
The web.config is read at app startup and everything in it is cached.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Orange you bland I stopped splaying bananas?


John Bailo said:
What's the cost of using a web.config key in a web method?

Is the value cached at start up? Or at first run? Or read on each
access?

Is web.config always "read off the disk" or can the file be cached?


I'm debating putting in a AppSetting[] entry versus hard coding for a web
service handling many hundreds of requests per hour.
 
Hello John
The value is cached at first run . whenever the web.config file changes, the
value is again read from web.config file.
I would recommend using web.config file because of the flexibility it brings
to the table than hard coding.
Thanks
Deepak
 
Back
Top