How do I avoid switching WCF endpoint when I deploy from localhost --> server?
-
13-10-2019 - |
Question
Right now I need to keep changing the line below. Is there a programmatic way to check if I am running the site locally vs. on production ?
The closest I got was this post but it seems to be referring to Silverlight and I am just calling from an asp.net site.
Silverlight application cannot accesss WCF services on other machines
<client>
<endpoint address="http://www.punkoutersoftware.com/Service1.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
</client>
Solution
A very similar situation is covered here: How to programmatically modify WCF app.config endpoint address setting?
OTHER TIPS
Is this for an ASP.NET application? If so, consider using VS2010's Web.config Transformation, which can alter your web.config based on your build type (Release, Debug, etc).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow