How to consume different web services on dev and live environments?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Danny Ni

    How to consume different web services on dev and live environments?

    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

    #2
    Re: How to consume different web services on dev and liveenvironment s?

    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

    Comment

    Working...