title: Can't add service reference to net tcp wcf service
body: <p>I have a WCF service hosted on my local machine as windows service. Now I'm trying to add a service reference in the client (again on my local dev machine) but I'm getting an error</p>
  
  <blockquote>
    <p>Metadata contains a reference that cannot be resolved:
    'net.tcp://localhost:8523/Service1'. Could not connect to
    net.tcp://localhost:8523/Service1. The connection attempt lasted for a
    time span of 00:00:02.0011145. TCP error code 10061: No connection
    could be made because the target machine actively refused it</p>
  </blockquote>
  
  <p>I checked that the Windows firewall doesn't block port 8523. I even created a new rule in Windows firewall to allow run 8523 port. But when I'm running <code>netstat -sp tcp</code> I can't seem to find port 8523. But I can see Serice1 service's state is set to START in Services. This is the config files</p>
  
  <p>Service Library</p>
  
  <pre><code>&lt;system.serviceModel&gt;
    &lt;services&gt;
      &lt;service name="WcfServiceLibrary1.Service1"&gt;
        &lt;endpoint 
             address="" 
             binding="netTcpBinding" bindingConfiguration=""
             contract="WcfServiceLibrary1.IService1"&gt;
           &lt;identity&gt;
             &lt;dns value="localhost" /&gt;
           &lt;/identity&gt;
        &lt;/endpoint&gt;
        &lt;endpoint 
             address="mex" 
             binding="mexTcpBinding" bindingConfiguration=""
             contract="IMetadataExchange" /&gt;
        &lt;host&gt;
          &lt;baseAddresses&gt;
            &lt;add baseAddress="net.tcp://localhost:8523/Service1" /&gt;
          &lt;/baseAddresses&gt;
        &lt;/host&gt;
      &lt;/service&gt;
    &lt;/services&gt;
    &lt;behaviors&gt;
      &lt;serviceBehaviors&gt;
        &lt;behavior name=""&gt;
          &lt;serviceMetadata httpGetEnabled="false" /&gt;
          &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
        &lt;/behavior&gt;
      &lt;/serviceBehaviors&gt;
    &lt;/behaviors&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>Config in the windows service project looks identical.</p>