什么时候WCF客户端连接丢失 [英] Tell when wcf client lost connection

查看:156
本文介绍了什么时候WCF客户端连接丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有工作作为WCF客户几台电脑,它们都连接到谁的作品作为WCF服务的计算机。
现在让我们说一个客户端连接丢失(即电缆断开),我怎么能知道发生在服务端?
我试图用关闭/关闭WCF回调事件,但我没有得到呼叫。
我写在C#。

I have a few computers working as WCF clients and they are connected to a computer who works as the WCF service. Now lets say one client connection is lost (i.e. the cable disconnects), How can I know that happened on the service side? I tried to use the wcf callbacks events Closing/Closed but I did not get the call. I am writing in C#.

最好的问候。
阿迪。

Best Regards. Adi.

推荐答案

您的服务不应该关心一个网线是否断开。 TCP的一个特点是,除非有人主动发送数据时,它可以容忍的网络连接短暂中断。

Your service should not care whether a network cable was disconnected. One feature of TCP is that unless someone is actively sending data, it can tolerate momentary interruptions in network connectivity.

这是即使在WCF更真实,那里有层层额外的框架,以帮助保护您免受网络不可靠。

This is even more true in WCF, where there are layers of extra framework to help protect you against network unreliability.

您会通过尝试来检测客户端断开完成主要的是降低了可靠性和可用性。

The main thing you would accomplish by attempting to detect disconnection of a client is reduced reliability and availability.

这篇关于什么时候WCF客户端连接丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆