Update Web Reference in Visual Studio
- by NeilD
Hi,
I have inherited a web site project that makes use of a number of WCF Web Services hosted on a BizTalk server.
We have two environments that I need to deploy this project to, with different URLs for the different BizTalk servers.
i.e. In the Staging environment, I need to point the services at xx.xx.xx.101
In the Live environment, I need to point them at xx.xx.xx.102, or whatever.
Currently, we've got all of the URLs stored in keys in the web.config file, so that we can change them dynamically... Unfortunately this isn't working!
If I change the URL in the web.config to something other than what the project was compiled with, I get an error when calling the service:
Server did not recognize the value of HTTP Header SOAPAction: xx.xx.xx.101\ServiceName\MethodName
I'm told that the only way they've known to deploy this is to update the web.config URLs, change all of the web references in Visual Studio to match, click on "update web reference" for each reference in Visual Studio, and then compile.
It's driving me mad! I've written a pre-build NAnt script to go through and replace all instances of the URL found anywhere in the project directory, and even that isn't making any difference.
There must be something else being pulled down from the service when I click the "update reference", but I'm new to working with web services, and so I'm not sure what.
Does anyone have any ideas? Is there a way to do this programatically?
Thanks.