title: Windows service (hosting WCF service) stops immediately on start up
body: <p>My Question: I cannot navigate to the base address once the service is installed because the service won't remain running (stops immediately). Is there anything I need to do on the server or my machine to make the baseAddress valid?</p>
  
  <p>Background: I'm trying to learn how to use WCF services hosted in Windows Services.  I have read several tutorials on how to accomplish this and it seems very straight forward.  I've looked at this <a href="http://msdn.microsoft.com/en-us/library/ms733069.aspx" rel="nofollow noreferrer">MSDN article</a> and built it step-by-step.  I can install the service on my machine and on a server, but when I start the service, it stops immediately.  I then found <a href="http://peterkellner.net/2010/06/18/wcf-service-in-managed-windows-service-vs2010-2" rel="nofollow noreferrer">this tutorial</a>, which is essentially the same thing, but it contains some clients that consume the WCF service. I downloaded the source code, compiled, installed, but when I started the service, it stopped immediately.</p>
  
  <p>Searching SO, I found a <a href="https://stackoverflow.com/questions/1182903/hosting-a-wcf-service-inside-a-windows-service">possible solution</a> that said to define the baseAddress when instantiating the ServiceHost, but that didnt help either.</p>
  
  <p>My serviceHost is defined as:</p>
  
  <pre><code>serviceHost = new ServiceHost( typeof( CalculatorService ), 
                   new Uri( "http://localhost:8000/ServiceModelSamples/service" ) );
  </code></pre>
  
  <p>My service name, base address, and endpoint:</p>
  
  <pre><code>&lt;service name="Microsoft.ServiceModel.Samples.CalculatorService" behaviorConfiguration="CalculatorServiceBehavior"&gt;
          &lt;host&gt;
              &lt;baseAddresses&gt;
                  &lt;add baseAddress="http://localhost:8000/ServiceModelSamples/service"/&gt;
              &lt;/baseAddresses&gt;
          &lt;/host&gt;
          &lt;endpoint address="" binding="wsHttpBinding" contract="Microsoft.ServiceModel.Samples.ICalculator"/&gt;
          &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt;
      &lt;/service&gt;
  </code></pre>
  
  <p>I've verified the namespaces are identical.  It's just getting frustrating that the tutorials seem to assume that the Windows service will start as long as all the stated steps are followed.  I'm missing something and it's probably right in front of me. Please help!</p>