title: TCP Error (10060) when trying to connect to remote WCF service
body: <p>I have a simple WCF service. For various reasons, all config is done programmatically rather than in xml. Service is self-hosted. When I run the host and client on my local machine, it works great. It also works great when I move the host to another machine on my LAN. However, when I try to get to the host on either machine by going outside my LAN (i.e. using my router's WAN address instead of the local LAN address) it doesn't work and I get the error below. I <em>am</em> forwarding port 8100 on my router to the service host machine. I've also cleared the port on the host firewall, as well as tried turning the firewall off completely. No joy on both. </p>
  
  <p>I'm using TCP with no security to keep things simple for now. Can anyone suggest what might be causing this behavior? Thank you. </p>
  
  <p>(Note: I masked the WAN and LAN address in the code below.)</p>
  
  <p>My client class:</p>
  
  <pre><code>public class TrackingClient : IService
  {
      protected readonly Binding binding;
      protected readonly EndpointAddress endpointAddress;
      IService proxy;
  
      public TrackingClient()
      {
          this.binding = new TCPBinding();
          this.endpointAddress = new EndpointAddress("net.tcp://WAN_IP:8100/Tracking");
  
          proxy = ChannelFactory&lt;IService&gt;.CreateChannel(
              binding,
              endpointAddress);
      }
  
      public bool report(Payload payload)
      {
          return proxy.report(payload);
      }
  }
  </code></pre>
  
  <p>My host class:</p>
  
  <pre><code>        ServiceHost host = new ServiceHost(typeof(Service));
          host.AddServiceEndpoint(
              typeof(IService),
              new TrackingComm.TCPBinding(),
              "net.tcp://LAN_IP:8100/Tracking");
  
          host.Open();
          Console.WriteLine("=== TRACKING HOST ===");
          Console.ReadLine();
          host.Close();
  </code></pre>
  
  <p>My binding:</p>
  
  <pre><code>public class TCPBinding : NetTcpBinding
  {
      public TCPBinding()
      {
          Security.Mode = SecurityMode.None;
          Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
          Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.None;
          Security.Message.ClientCredentialType = MessageCredentialType.None;
      }
  }
  </code></pre>
  
  <p>The error I get when the client tries to connect:</p>
  
  <pre><code>Could not connect to net.tcp://WAN_IP:8100/. The connection attempt lasted for a time span of 00:00:21.0772055. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond WAN_IP:8100.
  </code></pre>
  
  <p><strong>[EDIT]</strong></p>
  
  <p>After struggling with this for days, I finally managed to trace the issue to a loopback issue with my router. Although I still haven't figured out why, what's happening is that, although the router is set up forward the port, the call from the client isn't making it to the host when I use the WAN address. Whether it's being blocked "going out" or "coming in" through the router is still a mystery but when I run the client on another computer physically outside my LAN it works just fine</p>