Click to See Complete Forum and Search --> : web services and web.config


Zeb
October 4th, 2005, 08:17 PM
Hey guys,

Question about configuration for web services. I have a web.config, with an "appSettings" section and some key/value pairs for basic configuration of my web service. But, when I use ConfigurationSettings.AppSettings["key"], it is looking at the app.config of the application calling the web service. This makes sense to me, but my question is - what is the best way to store and access configuration information that is general to the web service? Even somewhere where I can put a filepath in that points to a confugration file would be satisfactory.

I checked something one of our other programmers did to configure a web service, and they had hard coded the path to an XML file into the web service and included a nice comment "config.xml should reside in the application path...". :sick:

Igor Soukhov
October 4th, 2005, 09:13 PM
If you're using ASP.NET Web Service, you should use the web.config file residing where you web application was deployed. The ConfigurationSettings.AppSettings should work fine in that case.

Hey guys,

Question about configuration for web services. I have a web.config, with an "appSettings" section and some key/value pairs for basic configuration of my web service. But, when I use ConfigurationSettings.AppSettings["key"], it is looking at the app.config of the application calling the web service. This makes sense to me, but my question is - what is the best way to store and access configuration information that is general to the web service? Even somewhere where I can put a filepath in that points to a confugration file would be satisfactory.

I checked something one of our other programmers did to configure a web service, and they had hard coded the path to an XML file into the web service and included a nice comment "config.xml should reside in the application path...". :sick:

Zeb
October 4th, 2005, 09:19 PM
So that should work... ok. It is probably because my test harness application is in the same solution as the web service (even though i reference the localhost webservice, not the webservice project). I'll run with this, and just leave the config I require in both the app.config for my test harness and the web.config for when it is deployed while I am still debugging.

Thanks Igor.