Web service address in config file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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!
*************************************************
 
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.
 
Back
Top