Reputation: 3571
We recently took over the maintenance a WCF Web service. While looking at the code, I saw that the service needed to access around 10 settings (string key-value pairs) very often and each time it needed this it used to load the settings.xml file into a XmlDocument and then access the value.
I believe that this is not ideal and have tried out the following approaches.
De-serialization:
appSettings in Web.Config:
Both approaches worked.
I would like to know which of the above 2 alternatives that I have tried is the best to save settings for my webservice? If there is some other alternative please feel free to point it out.
Upvotes: 1
Views: 470
Reputation: 2343
Generally, custom app settings are saved in web.config. This has two advantages: easy to read using built-in functions and offers automatic app reload when settings are updated.
Upvotes: 2