Question

I have a web-service that I will be deploying to dev, staging and production. Along with this will be an ASP.net application that will be deploying separately but also in those three stages.

What is the most pragmatic way to change the following line in the web-service to match the current environment?

[WebService(Namespace = "http://dev.mycompany.com/MyAppsWebService")]
[WebService(Namespace = "http://stage.mycompany.com/MyAppsWebService")]
[WebService(Namespace = "http://mycompany.com/MyAppsWebService")]
Was it helpful?

Solution

Your webservice object has a "URL" property on it which can be set via the web.config file. There's a config file that gets created when you add the web reference to your application that you should copy the contents of to your web.config or app.config file. You can then deploy the config file and not have to manage any code changes to accomodate the change in url.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top