title: Trouble with WCF (net.tcp) endpoint discovery using svcutil
body: <p>I have a project where I'm trying to implement a simple WCF service over TCP transport.This is what the service side code is shared below. </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.ServiceModel;
  using System.ServiceModel.Description;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace HwWcfService
  {
      class Program
      {
          static void Main(string[] args)
          {
  
  
              string Uri = string.Format("net.tcp://localhost:8000/TelemetryProviderService");
              ServiceHost host = new ServiceHost(
                      typeof(Calculator),
                      new Uri(Uri)
                      );
  
  
              NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);                
              host.AddServiceEndpoint(
                  typeof(ICalc),
                  binding,
                  "CalcService");
  
              host.Open();
  
              Console.WriteLine("Done starting the new endpoint...");
              Console.ReadKey();
  
          }
      }
  
  
  
      class Calculator :ICalc
      {
  
          public int Add(int x, int y)
          {
              Console.WriteLine(x + " " + y);
              return x + y;
          }
      }
  }
  
  
  
  
  
  namespace HwWcfService
  {
      [ServiceContract(
          Namespace="HwWcfService"
      )]
      interface ICalc
      {
  
          [OperationContract]
          int Add(int x, int y);
      }
  }
  </code></pre>
  
  <p>The App.Config file looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
  
      &lt;system.serviceModel&gt;
        &lt;services&gt;
          &lt;service behaviorConfiguration="ServiceBehaviour" name="HwWcfService.Calculator"&gt;
            &lt;endpoint address="net.tcp://localhost:8000/TelemetryProviderService" 
                      name="TelemetryProviderService"
                      contract="HwWcfService.ICalc"
                      binding="netTcpBinding"  
                      bindingConfiguration="calcTcpBindingConfiguration"
                      behaviorConfiguration="epBehaviourConfig"
                      /&gt;
  
            &lt;endpoint address="net.tcp://localhost:8000/TelemetryProviderServiceMex"
                      name ="TelemetryProviderServiceMex"
                      binding="mexTcpBinding"
                      contract="HwWcfService.ICalc"
                      listenUriMode="Explicit"
                      /&gt;
          &lt;/service&gt;
        &lt;/services&gt;
  
        &lt;bindings&gt;
          &lt;netTcpBinding&gt;
            &lt;binding name="calcTcpBindingConfiguration" closeTimeout="00:02:00"/&gt;
          &lt;/netTcpBinding&gt;
        &lt;/bindings&gt;
  
  
        &lt;behaviors&gt;
  
          &lt;endpointBehaviors&gt;
            &lt;behavior name="epBehaviourConfig"&gt;
            &lt;/behavior&gt;
          &lt;/endpointBehaviors&gt;
  
          &lt;serviceBehaviors&gt;
            &lt;behavior name="ServiceBehaviour"&gt;
              &lt;serviceMetadata httpGetUrl="false" httpGetEnabled="false"/&gt;
            &lt;/behavior&gt;
          &lt;/serviceBehaviors&gt;
  
        &lt;/behaviors&gt;
  
      &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>When I run svcutil.exe to query all the params I get the error:
  Error: Cannot obtain Metadata from net.tcp://localhost:8000/TelemetryProviderService</p>
  
  <p>If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the spe
  ified address.  For help enabling metadata publishing, please refer to the MSDN documentation at <a href="http://go.microsoft.com/fwlink/?LinkId=65455" rel="nofollow">http://go.microsoft.com/fwlink/?LinkId=65455</a>.</p>
  
  <p>WS-Metadata Exchange Error
      URI: net.tcp://localhost:8000/TelemetryProviderService</p>
  
  <pre><code>Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8000/TelemetryProviderService'.
  
  The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote hos
  </code></pre>
  
  <p>, or an underlying network resource issue. Local socket timeout was '00:04:59.9929977'.</p>
  
  <pre><code>An existing connection was forcibly closed by the remote host
  </code></pre>
  
  <p>Does anyone know why I'm getting this error ?</p>