我正在使用WCF双工通道进行服务回调交互,另外我在另一个端口上使用另一个服务。一段时间后,双工通道出现故障但是当我尝试使用它时,我得到一个通信异常(我不知道通道何时出现故障,我不能使用SessionFaulted事件)。接收超时是无限的,setTimeout是30秒。
问题是我找不到办法处理这个异常,没有堆栈跟踪,我无法在任何地方捕获它。
我使用行为扩展进行诊断/错误处理来调查,但没有运气。
例外:
2013-12-23 11:00:34,514 ERROR General - An exception was thrown during a service call.
Details: System.ServiceModel.CommunicationException: The socket connection was aborted.
This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue.
Local socket timeout was '10675199.02:48:05.4775807'. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.ServiceModel.Channels.SocketConnection.HandleReceiveAsyncCompleted()
at System.ServiceModel.Channels.SocketConnection.OnReceiveAsync(Object sender, SocketAsyncEventArgs eventArgs)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.End(IAsyncResult result, Message& message)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
有什么想法吗?
答案 0 :(得分:0)
经过长时间的研究,由于我没有其他选择,我决定比较新旧回调的参考,如果它们不同,则替换旧的回调。
接收到故障后,另一侧将关闭连接侧。
这不是最好的解决方案,因为它会扼杀通信合同,但它可以完成工作。