Maybe I am implementing WCF improperly, but I seem to be getting a WCF exception while using NetNamedPipedBindings
after making numerous calls.
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:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Multiple)]
Then, in my client I create a static DuplexChannelFactory
that I instantiate once and then use as needed via:
channelFactory.CreateChannel().MakeCall();
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 TimeoutException
. Here is my exception trace:
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)
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)
I have opened JustDecompile and see that this error is most likely happening here:
connection = this.connectionPoolHelper.EstablishConnection(timeout)
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?
UPDATE
I make about 6 pings before I start to see the call attempt and no return.
using(){}
pattern. – Henk Holterman