web.config and webservice

Discussion in 'ASP .Net Web Services' started by TR, May 24, 2004.

  1. TR

    TR Guest

    I'm having a little trouble developing a test webservice; the web.config
    file is not being handled the way I expected, based on previous
    experience with webforms apps.

    In my webforms apps, I've been putting the SQL connection string in the
    web.config
    file:

    <configuration>
    <appSettings>
    <add key="ConnectionString" value="Data Source=myhost\myserver;Initial
    Catalog=DB1;User Id=SQLUSER100;Password=mypassword;"/>
    </appSettings>
    <system.web>
    </system.web>
    </configuration>

    And then, in my webform class, a property encapsulates this particular
    appSetting:

    Private ReadOnly Property ConnectionString() As String
    Get
    Return ConfigurationSettings.AppSettings("ConnectionString")
    End Get
    End Property

    When I try to do the same with the webservice I'm experimenting with,
    the property is causes this error:

    "Name 'ConfigurationSettings' is not declared."

    Is the web.config file not applicable for webservices? If so, what is
    the best way to store and supply the connectionstring?

    Thanks
    TR
    TR, May 24, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Benny Ng
    Replies:
    9
    Views:
    9,957
    Benny Ng
    Oct 13, 2005
  2. ABC
    Replies:
    1
    Views:
    796
    Richard Dudley
    Oct 24, 2005
  3. CSharpner
    Replies:
    0
    Views:
    1,022
    CSharpner
    Apr 9, 2007
  4. ABC
    Replies:
    1
    Views:
    364
    Patrick.O.Ige
    Oct 31, 2005
  5. TR

    web.config and webservice

    TR, May 24, 2004, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    120
Loading...

Share This Page