2
我有一个托管WCF服务的Windows服务,该服务向多个客户端广播信息。我想优雅地处理来自客户端的服务关闭,即检测服务已经消失或想要关闭,弹出消息并关闭应用程序。目前,如果我关闭该服务,我会得到以下结果。在Windows服务中托管的WCF双工会话中处理服务关闭
“ServiceHost的关闭操作00后超时:00:09.9910000这可能是因为客户端未能在规定的时间内关闭会话通道。”
问题:我如何检测关闭,请求关闭客户端?
客户端,我得到的服务关闭后“插座异常视频时现有的连接被强行关闭远程主机”
这里是接近代码。
If Not (_LivePricingHost Is Nothing) Then
_LivePricingHost.Close()
_LivePricingHost = Nothing
End If
这里是我用来设置双面打印会话课,我已经删除了样板处理代码,我集资最多客户端的事件。
Imports System.ServiceModel
Public Class NotificationCallback
' Implements LivePricingService.IMessageCallback
Implements IDisposable
Private _ns As LivePricingService.MessageClient
Public Sub New()
Dim context = New InstanceContext(Me)
_ns = New LivePricingService.MessageClient(context)
_ns.SubscribeForBroadcast()
' _ns.AddMessage("PING")
End Sub
#End Region
末级