title: WCF multiple binding - Error: There was no endpoint listening
body: <p>I'm trying to setup a server and client in an asp WCF project to use various WCF binding modes.</p>
  
  <p>I'm getting this error when running in visual studio 2012:</p>
  
  <pre><code>There was no endpoint listening at http://localhost:9000/BasicHttp that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.  
  Unable to connect to the remote server
  
  Server stack trace:     at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)    at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, 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)
  
  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 WCF_ASMX.IWCF_Service.add(Int32[] list)    at WCF_ASMX._Default.NetPipeClient() in c:\xxx\Programming\c#\win_dotnet_sample_apps\WCF_ASMX_64bit_NamedPipe_F45\Default.aspx.cs:line 81    at WCF_ASMX._Default.Page_Load(Object sender, EventArgs e) in c:\xxx\Programming\c#\win_dotnet_sample_apps\WCF_ASMX_64bit_NamedPipe_F45\Default.aspx.cs:line 32    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)    at System.Web.UI.Control.OnLoad(EventArgs e)    at System.Web.UI.Control.LoadRecursive()    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  </code></pre>
  
  <p>Here is relevant part of my <code>web.config</code>:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
      &lt;behaviors&gt;
          &lt;endpointBehaviors&gt;
              &lt;behavior name="webHttpBinding_behaviour"&gt;
                  &lt;enableWebScript /&gt;
              &lt;/behavior&gt;
              &lt;behavior name="basicHttpBinding_behaviour"&gt;
              &lt;/behavior&gt;
              &lt;behavior name="netNamedPipeBinding_behaviour"&gt;
                  &lt;enableWebScript /&gt;
              &lt;/behavior&gt;
          &lt;/endpointBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"/&gt;
      &lt;services&gt;
          &lt;service name="WCF_Sample.WCF_Service"&gt;
              &lt;endpoint 
                  address="http://localhost:9000/BasicHttp" 
                  behaviorConfiguration="basicHttpBinding_behaviour"
                  binding="basicHttpBinding" 
                  contract="WCF_Sample.WCF_Service" /&gt;
              &lt;endpoint 
                  address="net.pipe://localhost/NetNamedPipe" 
                  behaviorConfiguration="netNamedPipeBinding_behaviour"
                  binding="netNamedPipeBinding" 
                  contract="WCF_Sample.WCF_Service" /&gt;
          &lt;/service&gt;
      &lt;/services&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>and here is my service:</p>
  
  <pre><code>[ServiceContract]
  public interface IWCF_Service
  {
      [OperationContract]
      int add(int[] list);
  }
  
  [ServiceContract]
  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
  [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
  public class WCF_Service : IWCF_Service
  {
      [OperationContract]
      [WebInvoke(Method = "GET")]
      public int add(int[] list)
      {
          int sum = 0;
          foreach(int val in list)
          {
              sum += val;
          }
          return sum;
      }
  }
  </code></pre>
  
  <p>and here is my client:</p>
  
  <pre><code>private void Client()
  {
      ChannelFactory&lt;IWCF_Service&gt; httpFactory =
            new ChannelFactory&lt;IWCF_Service&gt;(
              new BasicHttpBinding(),
              new EndpointAddress("http://localhost:9000/BasicHttp"));
  
      ChannelFactory&lt;IWCF_Service&gt; pipeFactory =
            new ChannelFactory&lt;IWCF_Service&gt;(
              new NetNamedPipeBinding(),
              new EndpointAddress("net.pipe://localhost/NetNamedPipe"));
  
      IWCF_Service httpProxy = httpFactory.CreateChannel();
      IWCF_Service pipeProxy = pipeFactory.CreateChannel();
  
      string str;
      str = "http: " + httpProxy.add(new int[] { 1, 2 });
      Console.WriteLine(str);
  
      str = "pipe: " + pipeProxy.add(new int[] { 1, 2 });
      Console.WriteLine(str);
  }
  </code></pre>
  
  <p>Does anyone know what I'm doing wrong?</p>
  
  <hr>
  
  <p><em>updating the code below:</em>
  while I'm still getting a similar error:</p>
  
  <pre><code>The pipe endpoint 'net.pipe://wcf_sample/' could not be found on your local machine.
  [PipeException: The pipe endpoint 'net.pipe://wcf_sample/' could not be found on your local machine. ]
  
  [EndpointNotFoundException: There was no endpoint listening at net.pipe://wcf_sample/ that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.]
  </code></pre>
  
  <p><em>new web.config:</em></p>
  
  <pre><code>  &lt;system.serviceModel&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="netNamedPipeBehavior"&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
            &lt;serviceMetadata /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;services&gt;
        &lt;service behaviorConfiguration="netNamedPipeBehavior" name="WCF_Sample.WCF_Service"&gt;
          &lt;endpoint address="" binding="netNamedPipeBinding" bindingConfiguration=""
            name="netNamedPipeEndPt" contract="WCF_Sample.IWCF_Service" /&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="net.pipe://WCF_Sample" /&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
    &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p><em>new client code:</em></p>
  
  <pre><code>private void Client()
  {
      ChannelFactory&lt;IWCF_Service&gt; pipeFactory =
        new ChannelFactory&lt;IWCF_Service&gt;(
          new NetNamedPipeBinding(),
          new EndpointAddress(
            "net.pipe://WCF_Sample"));
  
      IWCF_Service pipeProxy = pipeFactory.CreateChannel();
      string str;
      str = "pipe: " + pipeProxy.add(new int[] { 1, 2 });
      Console.WriteLine(str);
  }
  </code></pre>
  
  <p><em>When I open the service in the browser, I get this error:</em></p>
  
  <pre><code>The service class of type WCF_Sample.WCF_Service both defines a ServiceContract and inherits a ServiceContract from type WCF_Sample.IWCF_Service. Contract inheritance can only be used among interface types.  If a class is marked with ServiceContractAttribute, it must be the only type in the hierarchy with ServiceContractAttribute.  Consider moving the ServiceContractAttribute on type WCF_Sample.IWCF_Service to a separate interface that type WCF_Sample.IWCF_Service implements.
  [InvalidOperationException: The service class of type WCF_Sample.WCF_Service both defines a ServiceContract and inherits a ServiceContract from type WCF_Sample.IWCF_Service. Contract inheritance can only be used among interface types.  If a class is marked with ServiceContractAttribute, it must be the only type in the hierarchy with ServiceContractAttribute.  Consider moving the ServiceContractAttribute on type WCF_Sample.IWCF_Service to a separate interface that type WCF_Sample.IWCF_Service implements.]
     System.ServiceModel.Description.ServiceReflector.GetInterfaces(Type service) +12922331
     System.ServiceModel.ServiceHost.CreateDescription(IDictionary`2&amp; implementedContracts) +248
     System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +146
     System.ServiceModel.ServiceHost.InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses) +46
     System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +146
     System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +30
     System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +494
     System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1434
     System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +52
     System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +598
  
  [ServiceActivationException: The service '/WCF_Service.svc' cannot be activated due to an exception during compilation.  The exception message is: The service class of type WCF_Sample.WCF_Service both defines a ServiceContract and inherits a ServiceContract from type WCF_Sample.IWCF_Service. Contract inheritance can only be used among interface types.  If a class is marked with ServiceContractAttribute, it must be the only type in the hierarchy with ServiceContractAttribute.  Consider moving the ServiceContractAttribute on type WCF_Sample.IWCF_Service to a separate interface that type WCF_Sample.IWCF_Service implements..]
     System.Runtime.AsyncResult.End(IAsyncResult result) +489276
     System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +178
     System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +350382
     System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +9691825
  </code></pre>