0

我正在使用 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)

有任何想法吗?

4

1 回答 1

0

经过长时间的研究,由于我没有其他选择,我决定比较旧回调和新回调的引用,如果它们不同,则替换旧回调。

另一端将在收到故障时关闭其一侧的连接。

这不是最好的解决方案,因为它在某种程度上破坏了通信合同,但它确实完成了工作。

于 2014-03-11T08:19:27.253 回答