How to avoid timeouts in WCF?
I use netNamedPipeBinding
, and my service methods return nothing (void
), but they timeout:
TimeoutException: "The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout."
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.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) at System.ServiceModel.Channels.Ser开发者_开发问答viceChannel.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)
Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
To avoid this I turned my service into a OneWay
operation. But the timeout still occurs. I expected that it solved my problem. Its the netMsmqBinding the only one that could avoid such timeout?
I also tried to make all processing in a separate thread, so the service can disconnect earlier, with no success.
I feel it is a connection timeout. So the binding should not play a role in it. It might be that there is some issue for the service to accept the invocation. How have you deployed them or is there any issue on the server side? Can you do some logging or tracing? The tracelistener can be turned on probably.
精彩评论