当客户端在超时时断开连接时,WCF ServiceHost崩溃,导致单声道崩溃

时间:2018-10-23 02:41:29

标签: c# .net wcf mono

当客户端在超时后断开连接,然后服务器尝试返回结果时,出现以下错误:-

  

System.ArgumentException:值不在预期范围内。     在(包装器托管到本机)System.Object .__ icall_wrapper_mono_delegate_end_invoke(object,intptr)     在(包装委托端-调用).end_invoke_bool__this ___ Message&_IAsyncResult(System.ServiceModel.Channels.Message&,System.IAsyncResult)     在/ Users / builder / data / lanes / 5533 / mono-mac-sdk / external / bockbuild /中的System.ServiceModel.Channels.DuplexChannelBase.EndTryReceive(System.IAsyncResult结果,System.ServiceModel.Channels.Message&消息)[0x00000]构建/mono-x64/mcs/class/System.ServiceModel/System.ServiceModel.Channels/DuplexChannelBase.cs:196     在/ Users / builder / data / lanes / 5533 / mono-mac-sdk / external / bockbuild / builds / mono-x64 / mcs / class中的System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveDone(System.IAsyncResult结果)[0x0000c] /System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:596     在(包装器托管到本机)System.Runtime.Remoting.Messaging.AsyncResult.Invoke(System.Runtime.Remoting.Messaging.AsyncResult)     在/ Users / builder / data / lanes / 5533 / mono-mac-sdk / external / bockbuild / builds / monos-x64中的System.Runtime.Remoting.Messaging.AsyncResult.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()[0x00000] /mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs:210     在/ Users / builder / data / lanes / 5533 / mono-mac-sdk / external / bockbuild / builds / mono-x64 / mcs / class / referencesource / mscorlib / system中的System.Threading.ThreadPoolWorkQueue.Dispatch()[0x00074] /threading/threadpool.cs:856     在/ Users / builder / data / lanes / 5533 / mono-mac-sdk / external / bockbuild / builds / mono-x64 / mcs / class / referencesource / mscorlib / system中的System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()[0x00000] /threading/threadpool.cs:1211

1 个答案:

答案 0 :(得分:0)

该错误通常表示与该客户端通信的频道发生错误,然后服务器尝试与该频道进行通信,例如聊天应用

当我们使用WCF双工模式时。您可以使用

Channel.Closing+=new EventHandler(Channel_Closing)

监听客户端的状态。

我建议您使用心跳数据包指示客户端状态,然后处理错误/处理逻辑。