简体   繁体   English

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

[英]WCF ServiceHost crashes mono when client disconnects on timeout

I am getting the below error when client disconnects after the timeout and then server tries to return the result: - 当客户端在超时后断开连接,然后服务器尝试返回结果时,出现以下错误:-

System.ArgumentException: Value does not fall within the expected range. System.ArgumentException:值不在预期范围内。 at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_delegate_end_invoke(object,intptr) at (wrapper delegate-end-invoke) .end_invoke_bool__this___Message&_IAsyncResult(System.ServiceModel.Channels.Message&,System.IAsyncResult) at System.ServiceModel.Channels.DuplexChannelBase.EndTryReceive (System.IAsyncResult result, System.ServiceModel.Channels.Message& message) [0x00000] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.ServiceModel/System.ServiceModel.Channels/DuplexChannelBase.cs:196 at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveDone (System.IAsyncResult result) [0x0000c] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:596 at (wrapper managed-to-native) System.Runtime.Remoting.Messaging.AsyncResult.Invoke(System.Runtime.Remoting.Messaging.AsyncResult) at System.Runtime.Remoting.Messaging. 在(包装器托管到本机)System.Object .__ icall_wrapper_mono_delegate_end_invoke(对象,intptr)在(包装器委托结束调用).end_invoke_bool__this ___ Message&_IAsyncResult(System.ServiceModel.Channels.Message&,System.IAsyncResults)在System.ServiceModel.Channel / Users / builder / data / lanes / 5533 / mono-mac-sdk / external / bockbuild / builds / mono-x64 / mcs中的DuplexChannelBase.EndTryReceive(System.IAsyncResult结果,System.ServiceModel.Channels.Message&消息)[0x00000] / Users / builder / data / lanes / 5533 / mono中的/class/System.ServiceModel/System.ServiceModel.Channels/DuplexChannelBase.cs:196位于System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveDone(System.IAsyncResult结果)[0x0000c] -mac-sdk / external / bockbuild / builds / mono-x64 / mcs / class / System.ServiceModel / System.ServiceModel.Dispatcher / ChannelDispatcher.cs:596((包装托管到本地)System.Runtime.Remoting.Messaging System.Runtime.Remoting.Messaging上的.AsyncResult.Invoke(System.Runtime.Remoting.Messaging.AsyncResult)。 AsyncResult.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs:210 at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:856 at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1211 / Users / builder / data / lanes / 5533 / mono-mac-sdk / external / bockbuild / builds / mono-x64 / mcs / class / corlib / System中的AsyncResult.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()[0x00000]。 System.Threading.ThreadPoolWorkQueue.Dispatch()中的Runtime.Remoting.Messaging / AsyncResult.cs:210()[0x00074]在/ Users / builder / data / lanes / 5533 / mono-mac-sdk / external / bockbuild / builds / mono- x64 / mcs / class / referencesource / mscorlib / system / threading / threadpool.cs:856,位于/ Users / builder / data / lanes / 5533 / mono-mac-sdk /中的System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()[0x00000]外部/ bockbuild /建立/单X64 / MCS /类/ referencesource / mscorlib程序/系统/线程/ threadpool.cs:1211

The error typically indicates that the channel communicated with that client has an error, and then the server tries to communicated with the channel, for example Chatting application . 该错误通常表示与该客户端通信的通道有错误,然后服务器尝试与该通道通信,例如, 聊天应用程序

When we use the WCF duplex mode. 当我们使用WCF双工模式时。 you could use 你可以用

Channel.Closing+=new EventHandler(Channel_Closing)

to listen the status of the client. 聆听客户的状态。

I suggest you use the Heartbeat packet to indicates the client status, and then handle the errors/process the logic. 我建议您使用心跳数据包指示客户端状态,然后处理错误/处理逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM