Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / April 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Danny Ni - 09 Apr 2008 15:01 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.