CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2001
    Location
    Melbourne, Australia
    Posts
    576

    web services and web.config

    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...".

  2. #2
    Join Date
    Feb 2001
    Location
    Sydney, Australia
    Posts
    1,909

    Re: web services and web.config

    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.

    Quote Originally Posted by Zeb
    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...".
    Best regards,
    Igor Sukhov

    www.sukhov.net

  3. #3
    Join Date
    Oct 2001
    Location
    Melbourne, Australia
    Posts
    576

    Re: web services and web.config

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured