title: TimeoutException in WCF after multiple calls
body: <p>Maybe I am implementing WCF improperly, but I seem to be getting a WCF exception while using <code>NetNamedPipedBindings</code> after making numerous calls. </p>
  
  <p>Here is the high level of what I am doing. Basically, I am working on an out of proc exe and using WCF named pipes to communicate back and forth. I leave my host open via this attribute:</p>
  
  <pre><code>[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, 
      ConcurrencyMode = ConcurrencyMode.Multiple)]
  </code></pre>
  
  <p>Then, in my client I create a <code>static DuplexChannelFactory</code> that I instantiate once and then use as needed via:</p>
  
  <pre><code>channelFactory.CreateChannel().MakeCall();
  </code></pre>
  
  <p>I have added a Ping method just to make sure that the host is working properly (since the host will send events back that we do not want to miss without knowing). This Ping method runs once every 5 seconds and simply returns a true. However, after running for a couple of minutes I get a <code>TimeoutException</code>. Here is my exception trace:</p>
  
  <blockquote>
    <p>Server stack trace:     at
    System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan
    timeout)    at
    System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan
    timeout)    at
    System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)<br>
    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.ServiceChannel.Call(String action,
    Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
    Object[] outs)    at
    System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
    methodCall, ProxyOperationRuntime operation)    at
    System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
    message)</p>
  </blockquote>
  
  <p>I have opened JustDecompile and see that this error is most likely happening here:</p>
  
  <pre><code>connection = this.connectionPoolHelper.EstablishConnection(timeout)
  </code></pre>
  
  <p>However, I do not see any reason why this would timeout after working for a couple of pings previously? What setting do I need to set to make this infinite and/or is there another way for me to implement this WCF event server (it is used for on-demand processing too) from the client or server side?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I make about 6 pings before I start to see the call attempt and no return.</p>