title: Cannot listen on pipe name because another pipe endpoint is already listening on that name
body: <p>I am getting the following error:</p>
  <p>Cannot listen on pipe name 'net.pipe://localhost/ServiceModelSamples/service/' because another pipe endpoint is already listening on that name</p>
  <p>I am calling WCF self hosted service inside windows service from another WCF call as follows.</p>
  <p>$</p>
  <pre><code>ServiceHost _host;
  var guidid = Guid.NewGuid().ToString() ;
  
  _host = new ServiceHost(typeof(CalculatorService), new Uri[] { new Uri(&quot;net.pipe://localhost/&quot; + guidid)});
  
  _host.AddServiceEndpoint(typeof(ICalculator),
          new NetNamedPipeBinding(),
          &quot;&quot;);
  
  _host.Open();
  
  ChannelFactory&lt;ICalculator&gt; factory = new ChannelFactory&lt;ICalculator&gt;(
      new NetNamedPipeBinding(NetNamedPipeSecurityMode.None),
      new EndpointAddress(&quot;net.pipe://localhost/&quot; + guidid));
  ICalculator proxy = factory.CreateChannel();
  proxy.SendPin(pin);
  ((IClientChannel)proxy).Close();
  factory.Close();
  </code></pre>
  <p><strong>Self-Hosted WCF Service</strong></p>
  <p>$</p>
  <pre><code>namespace PINSender
  {
      // Define a service contract.    
      
      public interface ICalculator
      {
          [OperationContract]
          void SendPin(string pin);
      }
  
      // Implement the ICalculator service contract in a service class.
      public class CalculatorService : ICalculator
      {
          // Implement the ICalculator methods.
          public void  SendPin(string pin)
          {
              
          }
      }
  
      public class CalculatorWindowsService : ServiceBase
      {
          public ServiceHost serviceHost = null;
          public CalculatorWindowsService()
          {
              // Name the Windows Service
              ServiceName = &quot;PINSenderService&quot;;
          }
  
          public static void Main()
          {
              ServiceBase.Run(new CalculatorWindowsService());
          }
  
          // Start the Windows service.
          protected override void OnStart(string[] args)
          {
              if (serviceHost != null)
              {
                  serviceHost.Close();
              }
  
              // Create a ServiceHost for the CalculatorService type and 
              // provide the base address.
              serviceHost = new ServiceHost(typeof(CalculatorService));
  
              // Open the ServiceHostBase to create listeners and start 
              // listening for messages.
              serviceHost.Open();
          }
  
          protected override void OnStop()
          {
              if (serviceHost != null)
              {
                  serviceHost.Close();
                  serviceHost = null;
              }
          }
      }
  
      // Provide the ProjectInstaller class which allows 
      // the service to be installed by the Installutil.exe tool
      [RunInstaller(true)]
      public class ProjectInstaller : Installer
      {
          private ServiceProcessInstaller process;
          private ServiceInstaller service;
  
          public ProjectInstaller()
          {
              process = new ServiceProcessInstaller();
              process.Account = ServiceAccount.LocalSystem;
              service = new ServiceInstaller();
              service.ServiceName = &quot;PINSenderService&quot;;
              Installers.Add(process);
              Installers.Add(service);
          }
      }
  }
  </code></pre>
  <p><strong>App.Config</strong></p>
  <p>$</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;configuration&gt;
  &lt;system.serviceModel&gt;
  &lt;bindings&gt;
    &lt;!-- 
      Following is the expanded configuration section for a NetNamedPipeBinding.
      Each property is configured with the default value.
   --&gt;
    &lt;netNamedPipeBinding&gt;
      &lt;binding name=&quot;Binding1&quot;
               closeTimeout=&quot;00:01:00&quot;
               openTimeout=&quot;00:01:00&quot;
               receiveTimeout=&quot;00:10:00&quot;
               sendTimeout=&quot;00:01:00&quot;
               transactionFlow=&quot;false&quot;
               transferMode=&quot;Buffered&quot;
               transactionProtocol=&quot;OleTransactions&quot;
               hostNameComparisonMode=&quot;StrongWildcard&quot;
               maxBufferPoolSize=&quot;524288&quot;
               maxBufferSize=&quot;65536&quot;
               maxConnections=&quot;10&quot;
               maxReceivedMessageSize=&quot;65536&quot;&gt;
        &lt;security mode=&quot;Transport&quot;&gt;
          &lt;transport protectionLevel=&quot;EncryptAndSign&quot; /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/netNamedPipeBinding&gt;
  &lt;/bindings&gt;
  
  &lt;services&gt;
    
    &lt;service name=&quot;PINSender.CalculatorService&quot;
             behaviorConfiguration=&quot;CalculatorServiceBehavior&quot;&gt;
      &lt;host&gt;
        &lt;baseAddresses&gt;            
          &lt;add baseAddress=&quot;net.pipe://localhost/PINSenderService&quot;/&gt;
        &lt;/baseAddresses&gt;          
      &lt;/host&gt;
      
      &lt;endpoint address=&quot;&quot;
                binding=&quot;netNamedPipeBinding&quot;
                contract=&quot;PINSender.ICalculator&quot; bindingConfiguration=&quot;Binding1&quot; /&gt;
      &lt;endpoint address=&quot;mex&quot;
                binding=&quot;mexNamedPipeBinding&quot;
                contract=&quot;IMetadataExchange&quot; /&gt;                 
    &lt;/service&gt;
  &lt;/services&gt;
  &lt;behaviors&gt;      
    &lt;serviceBehaviors&gt;        
      &lt;behavior name=&quot;CalculatorServiceBehavior&quot;&gt;
        &lt;serviceMetadata httpGetEnabled=&quot;False&quot;  /&gt;
        &lt;serviceDebug includeExceptionDetailInFaults=&quot;False&quot;/&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
    &lt;/behaviors&gt;
   &lt;/system.serviceModel&gt;
  /configuration&gt;
  </code></pre>