Hi,
I am working on a project that consumes web service, on my dev machine I
added a web reference to http://dev.mydomain.com/webservice1.asmx. But when
the codes deployed to live, I need to consume
http://live.mydomain.com/webservice1.asmx instead.
Other than manually changing the web reference upon deployment, is there
anything else I can do?
TIA
Marc Gravell - 09 Apr 2008 15:40 GMT
It depends at what point you can make the decision about where the
endpoint is, and how you are deploying it. For example, if you are
using ClickOnce you cannot change the app.config post-build, as the
crypto-hash won't match and it will refuse to run. Personally, I'd
have this as part of my automated build process - i.e. update the
app.config just before build.
Another option is runtime; WCF supports named endpoints, so you could
have all of them there, and decide at runtime which to use.
Marc
Peter Bromberg [C# MVP] - 09 Apr 2008 17:09 GMT
Danny,
A webservice has a URL property that you can set at runtime from an entry in
the appSettings Section (for example) of your web.config file. You set the
URL of the service endpoint right after instantiating the service proxy class
and just before making a webmethod call.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
> Hi,
>
[quoted text clipped - 7 lines]
>
> TIA