Hi, I've a asp.net web solution which references a web service from another web site (also in our development environment). I want to know if I need to change the address of the web service (from production server) when deploying to production and how or if it is not necessary to make any changes?
A:
I'd say put the actual URL of the webservice in the appSettings part of your web.config, then use that at runtime.
Colin
2009-07-10 08:36:33
exactly but I want to know how?
TheVillageIdiot
2009-07-10 08:38:01
+5
A:
First off, make sure the WebService is set to Dynamic.
Then I suggest you put the URI in your web.config file as follows:
<appSettings>
<add key="WebServiceUri" value="http://example.com/service.asmx"/>
</appSettings>
When you then instantiate the WebService, do the following:
WebService service = new WebService();
service.Uri = ConfigurationSettings.AppSettings["WebServiceUri"];
The WebService will now use that URI in every WebService request it makes.
GenericTypeTea
2009-07-10 08:40:46