title: WCF Service - Self Hosting Service does not work
body: <p>I have a WCF Service application created in VS 2010. When I execute it, I got the service page in the following local url </p>
  
  <p><img src="https://i.stack.imgur.com/EdX1b.jpg" alt="enter image description here"></p>
  
  <p>I created another self hosting console application as shown below. It is throwing following exception</p>
  
  <blockquote>
    <p>HTTP could not register URL. Your process does not have access rights to this namespace (see <a href="http://go.microsoft.com/fwlink/?LinkId=70353" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=70353</a> for details).</p>
  </blockquote>
  
  <p>Well, I have no particular interest in the 49609 port number. I just copied it from the other working service.</p>
  
  <p>Now, I have bare minimum rights for running the WCF service. What change I need to do to make the following code to succeed?</p>
  
  <p>Note: There is no chance for me to get the administrator rights in this machine.</p>
  
  <p>Note: I am fine with any port number that will work.</p>
  
  <pre><code>namespace ConsoleApplication1
  {
  class Program
  {
      static void Main(string[] args)
      {
          string baseAddress = "http://" + Environment.MachineName + ":49609/Service";
          ServiceHost host1 = new ServiceHost(typeof(Service1), new Uri(baseAddress));
          host1.AddServiceEndpoint(typeof(ConsoleApplication1.IService1), new BasicHttpBinding(), baseAddress);
          host1.Open();
  
      }
      static Binding GetBinding()
      {
          BasicHttpBinding result = new BasicHttpBinding();
          return result;
      }
  
  }
  
  }
  </code></pre>
  
  <p><strong>Service</strong></p>
  
  <pre><code>public class Service1 : IService1
  {
      public int Add(int n1, int n2)
      {
          return n1 + n2;
      }
  }
  
  [ServiceContract]
  public interface IService1
  {
      [OperationContract]
      int Add(int n1, int n2);
  }
  </code></pre>