views:

925

answers:

1

I have a webservice 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 webservice 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")]
+1  A: 

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.

lomaxx