title: Change the url of a web service by reading from the web.config
body: <p>I have a WCF app that consumes an asmx web service. I use the web service in a million places in the app:</p>
  
  <pre><code>    public string LogOnUser(string username, string password, string db)
      {
          var wsi = new ASMXServiceInterface();
          return wsi.LogIn();
        }
  
      public string GetNotes(string username, string password, string db)
      {
          var wsi = new ASMXServiceInterface();
          return wsi.GetNotes();
        }
  
      etc, etc etc...
  </code></pre>
  
  <p>Of course i want to set the url of the service in the contructor, but its auto generated in reference.cs and if i change it there, it works but if i update  my reference ( and i will) its lost and i have to manually do it again:</p>
  
  <pre><code>      /// &lt;remarks/&gt;
      public ASMXServiceInterface()
      {
          this.Url = 
      System.Web.Configuration.WebConfigurationManager.AppSettings["RQTCSServiceURL"];
     }
  </code></pre>
  
  <p>The web service url will need to be dynamic because different versions of it have been implemented. How can i set the url of my web service once in my WCF project so the url of the service can be changed in the web.config without having to do it in reference.cs? </p>