title: WCF net.tcp communication error
body: <p>I created a WCF Service with net.tcp binding and I was able to add a service reference to it in my console application without errors.</p>
  
  <p>After doing this I am trying to self host this service in my console app. The service Host gets opened but when I call a method in the service with the service reference object I get this exception</p>
  
  <p>'Could not connect to net.tcp://localhost/Design_Time_Addresses/MyWCFServiceLibrary/Service2/. The connection attempt lasted for a time span of 00:00:02.0800000. TCP error code 10061: No connection could be made because the target machine actively refused it [::1]:808.'</p>
  
  <p>This is my cs file code</p>
  
  <pre><code>Main method()
  
   Service2Client sc2 = new Service2Client();
                  Uri baseaddress = new Uri("net.tcp://localhost:8732/Design_Time_Addresses/MyWCFServiceLibrary/Service2/");
  
                  ServiceHost serviceHost = new ServiceHost(typeof(Service2Client), baseaddress);
  
                  serviceHost.Open();
  
                  Console.WriteLine(sc2.GetData(124)); --&gt; exception comes at this point
  
                  Console.ReadLine();
  </code></pre>
  
  <p>This is app.config in console app</p>
  
  <pre><code>&lt;system.serviceModel&gt;
      &lt;client&gt;
        &lt;endpoint address="net.tcp://localhost/Design_Time_Addresses/MyWCFServiceLibrary/Service2/"
          binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IService2"
          contract="ServiceReference2.IService2" name="NetTcpBinding_IService2"&gt;
          &lt;identity&gt;
            &lt;dns value="localhost" /&gt;
          &lt;/identity&gt;
        &lt;/endpoint&gt;
      &lt;/client&gt;
      &lt;bindings&gt;
        &lt;netTcpBinding&gt;
          &lt;binding name="NetTcpBinding_IService2" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
            hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
            maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536"&gt;
            &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
            &lt;reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" /&gt;
            &lt;security mode="None"&gt;
              &lt;transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" /&gt;
              &lt;message clientCredentialType="Windows" /&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
        &lt;/netTcpBinding&gt;
      &lt;/bindings&gt;
      &lt;!--&lt;client&gt;
        &lt;endpoint address="net.tcp://localhost:8732/Design_Time_Addresses/MyWCFServiceLibrary/Service2/"
          binding="netTcpBinding" bindingConfiguration="NewBinding0" contract="MyWCFServiceLibrary.IService2"
          name="endpointClient" /&gt;
        &lt;endpoint address="net.tcp://localhost/Design_Time_Addresses/MyWCFServiceLibrary/Service2/"
          binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IService2"
          contract="ServiceReference2.IService2" name="NetTcpBinding_IService2"&gt;
          &lt;identity&gt;
            &lt;dns value="localhost" /&gt;
          &lt;/identity&gt;
        &lt;/endpoint&gt;
      &lt;/client&gt;--&gt;
    &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>Environment: Vs2010</p>
  
  <p>Can any one please help me on this.</p>