Home All Groups Group Topic Archive Search About

Web service address in config file

Author
2 Oct 2006 4:47 PM
Craig HB
I have added a webservice reference to my ASP.NET (ver 2) project, but adding
it Web References in the solution explorer.

However, I want  the URL to the webservice to be in a config file (like
web.config) and not in the dll. How do I do this ?

Thanks,
Craig

Author
2 Oct 2006 5:57 PM
Cowboy (Gregory A. Beamer)
If you added as a web reference, you should have a config file with a key
like this:

<appSettings>
    <add key="HelloWorldService.Service"
            value="http://localhost:4137/TestWebService/Service.asmx"/>
</appSettings>

Change the value to the URL you now want to point to.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
Show quote
"Craig HB" <Crai***@discussions.microsoft.com> wrote in message
news:15B1A6D9-1BB4-490E-B8CA-1F579840DB06@microsoft.com...
>I have added a webservice reference to my ASP.NET (ver 2) project, but
>adding
> it Web References in the solution explorer.
>
> However, I want  the URL to the webservice to be in a config file (like
> web.config) and not in the dll. How do I do this ?
>
> Thanks,
> Craig
Author
3 Oct 2006 7:59 AM
Craig HB
My ASP.NET project references a Class Library project that references that
web service. I can see that app.config file in the Class Library project
folder, but is there a way to change that web service without re-compiling
the ASP.NET project.

I have looked on the live  server and (although there is web.config for the
ASP.NET project) I can't find a config file for the web service -- just a dll
in the bin folder.

If this is not possible, is there a way to set up the project so that if
there are future changes to the web service URL, I can change that in the
ASP.NET config and not have to re-compile the project.

AddThis Social Bookmark Button