TheVillageIdiot
TheVillageIdiot

Reputation: 40527

Deploying asp.net Web Service referencing web service

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?

Upvotes: 4

Views: 1595

Answers (2)

djdd87
djdd87

Reputation: 68506

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.

Upvotes: 7

Colin
Colin

Reputation: 10638

I'd say put the actual URL of the webservice in the appSettings part of your web.config, then use that at runtime.

Upvotes: 0

Related Questions