web.config and webservice

T

TR

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top