title: Best way to manage multiple Service References in .NET
body: <p>I have a C# ASP.NET project with 15 WCF/ASMX Service References. Each service is deployed to three different servers; <code>test</code>, <code>staging</code> and <code>live</code>.</p>
  
  <p>Often we need to change the URLs of these service references to different servers, to be able to debug using the correct service with the correct implementation and data.</p>
  
  <p>When managing these Service References I'm having a hard time keeping the URL in sync. When creating a Service Reference <code>FooService</code> it stores the URL in three seperate files:</p>
  
  <ul>
  <li>FooService.disco</li>
  <li>configuration.svcinfo</li>
  <li>Reference.svcmap</li>
  </ul>
  
  <p>Along with creating an <code>endpoint</code> node with the URL in the <code>Web.config</code>.</p>
  
  <p>If I change the endpoint URL in the Web.config and rebuild the project, it doesn't update the URL in the other files, so it's out of sync. So when I right-click the <code>FooService</code> and click <code>Update Service Reference</code> it doesn't use the URL stored in the <code>Web.config</code>, it uses the URL in the other files.</p>
  
  <p>So the only way is to right-click the <code>FooService</code> and click on <code>Configure Service Reference</code> and enter the new URL. But that doesn't always work, because sometimes it creates a new node in Web.config named <code>FooService1</code>, so I get an error when running my application saying that there are two instances of the same endpoints.</p>
  
  <p>So often I need to skim through the Web.config and delete duplicates of endpoints, which is very frustrating.</p>
  
  <p>What is the best way to manage multiple WCF service references when changing the URL to the service often?</p>