从客户端

时间:2017-09-04 21:23:05

标签: c# wcf keep-alive duplex

我有一个连接到服务器的客户端,该服务器可能每天都会停机并重新启动几次。到目前为止,我在客户端使用以下方法检查故障连接,故障处理程序重新建立连接回服务器的连接:

ICommunicationObject communicationObject = this as ICommunicationObject;
communicationObject.Faulted +=
   new EventHandler((sender, e) => { OnFaulted(sender, e); });

任何人都可以建议最好的(最佳实践)方法来维护客户端的持久双工连接吗?

额外信息:

使用上面的代码,其中'this'是从DuplexClientBase继承的客户端连接,如果服务器只是关闭(application.exit),则不会触发处理程序,是否有更好的方法来处理它?<​​/ p>

0 个答案:

没有答案