title: Working with Named Pipes in WCF, PipeException thrown?
body: <p>Despite many searches and read articles such as this: <a href="http://blogs.charteris.com/blogs/chrisdi/archive/2008/05/19/exploring-the-wcf-named-pipe-binding-part-1.aspx" rel="nofollow">Exploring the WCF Named Pipe Binding - Part 1</a>(part 2 and 3 inclusively), I haven't been able to make my service work properly.</p>
  
  <p>Here's my config:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
    &lt;client&gt;
      &lt;endpoint address="net.pipe://localhost/GlobalPositioningService"
                binding="netNamedPipeBinding" 
                contract="GI.Services.GlobalPositioning.Contracts.IGlobalPositioning" /&gt;
    &lt;/client&gt;
    &lt;services&gt;
      &lt;service name="GI.Services.GlobalPositioning.Services.GlobalPositioningService"&gt;
        &lt;endpoint address=""
                  binding="wsHttpBinding"
                  contract="GI.Services.GlobalPositioning.Contracts.IGlobalPositioning"&gt;
          &lt;identity&gt;
            &lt;dns value="localhost" /&gt;
          &lt;/identity&gt;
        &lt;/endpoint&gt;
        &lt;endpoint address="net.pipe://localhost/GlobalPositioningService"
                  binding="netNamedPipeBinding"
                  contract="GI.Services.GlobalPositioning.Contracts.IGlobalPositioning" /&gt;
        &lt;host&gt;
          &lt;baseAddresses&gt;
            &lt;add baseAddress="http://localhost:8080/GlobalPositioningService/"/&gt;
          &lt;/baseAddresses&gt;
        &lt;/host&gt;
      &lt;/service&gt;
    &lt;/services&gt;
  </code></pre>
  
  <p></p>
  
  <p>Then, I try to test my service through Named Pipes:</p>
  
  <pre><code>[TestFixture]
  public class GlobalPositioningServiceTests {
      [TestFixtureSetUp]
      public void SetUpHost() {
          var channelFactory = new ChannelFactory&lt;IGlobalPositioning&gt;(binding, new EndpointAddress(address));
          channelFactory.Open();
          service = channelFactory.CreateChannel();
      }
  
      private const string address = "net.pipe://localhost/GlobalPositioningService";
      private static readonly Binding binding = new NetNamedPipeBinding();
      private static IGlobalPositioning service;
  }
  </code></pre>
  
  <p>And I have also tried another way using a ServiceHost instance:</p>
  
  <pre><code>    [TestFixtureSetUp]
      public void SetUpHost() {
          host = new ServiceHost(typeof(GlobalPositioningService));
          host.AddServiceEndpoint(typeof(IGlobalPositioning), binding, address);
          host.Open();
          service = new GlobalPositioningService();
      }
  </code></pre>
  
  <p>And I always obtain this error with stack trace:</p>
  
  <blockquote>
    <p>Error  2   Test 'GI.Services.GlobalPositioning.Services.Tests.GlobalPositioningServiceTests.GetGlobalPositionWorksWithDiacriticsInMunicipalityName("143, rue Marcotte, Sainte-Anne-de-la-P\x00E9rade",46.5736528d,-72.2021346d)' failed:
        System.ServiceModel.EndpointNotFoundException : There was no endpoint listening at net.pipe://localhost/GlobalPositioningService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
      ----> System.IO.PipeException : The pipe endpoint 'net.pipe://localhost/GlobalPositioningService' could not be found on your local machine. </p>
    
    <p>Server stack trace:
    at System.ServiceModel.Channels.PipeConnectionInitiator.GetPipeName(Uri uri)
    at System.ServiceModel.Channels.NamedPipeConnectionPoolRegistry.NamedPipeConnectionPool.GetPoolKey(EndpointAddress address, Uri via)
    at System.ServiceModel.Channels.CommunicationPool`2.TakeConnection(EndpointAddress address, Uri via, TimeSpan timeout, TKey&amp; key)
    at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
    at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
    at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)</p>
    
    <p>Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
    at GI.Services.GlobalPositioning.Contracts.IGlobalPositioning.GetGlobalPosition(String mailingAddress)
    at GI.Services.GlobalPositioning.Services.Tests.GlobalPositioningServiceTests.GetGlobalPositionWorksWithDiacriticsInMunicipalityName(String address, Double latitude, Double longitude) in C:\Open\Projects\Framework\Src\GI.Services\GI.Services.GlobalPositioning.Services.Tests\GlobalPositioningServiceTests.cs:line 27
    --PipeException C:\Open\Projects\Framework\Src\GI.Services\GI.Services.GlobalPositioning.Services.Tests\GlobalPositioningServiceTests.cs    27  </p>
  </blockquote>
  
  <p>For your information, I'm using:</p>
  
  <ol>
  <li>Visual Studio 2010</li>
  <li>Windows 7</li>
  <li>NUnit</li>
  </ol>
  
  <p>And my service is contained within a WCF Service Library.</p>