如何检查的net.tcp WCF服务的可用性 [英] How to check the availability of a net.tcp WCF service

查看:412
本文介绍了如何检查的net.tcp WCF服务的可用性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的WCF服务器需要上上下下定期,客户有时会使用服务器,但如果是降低客户端忽略它。
所以每次我需要使用服务器提供的服务,请检查连接状态,如果它没有打开我打开它。
现在的问题是,如果我尝试打开,而服务器那里是打性能的延迟。
我的问题是,有没有办法做某种 myClient.CanOpen的()?所以我想知道是否有任何点开到服务器的连接。

My WCF server needs to go up and down on a regular basis, the client sometimes uses the server, but if it is down the client just ignore it. So each time I need to use the server services I check the connection state and if it's not open I open it. The problem is that if I attempt to open while the server is down there is a delay which hits performance. My question is, is there a way to do some kind of myClient.CanOpen()? so I'd know if there is any point to open the connection to the server.

推荐答案

有是WS-发现的实​​现,将允许你听向上/向下公告为您服务。这也是服务地址解析的一个很方便的形式,因为它利用了UDP多播消息来发现该服务,而不是在客户端上配置一个集地址。
WS-和发现WCF

There is an implementation of WS-Discovery that would allow you to listen for up/down announcements for your service. This is also a very convenient form of service address resolution because it utilizes UDP multicast messages to find the service, rather than configuring one set address on the client. WS-Discovery for WCF

还有一个微软员工做一个实现:
WS发现样品实施

There's also an implementation done by a Microsoft employee: WS-Discovery Sample Implementation

.NET 4.0将包括此本身。你可以阅读有关.NET 4.0的耶稣罗德里格斯的博客实现。它有一个很大的图表,详细说明了那张在WS-迪斯科的在WCF中使用WS-发现4.0

.NET 4.0 will include this natively. You can read about .NET 4.0's implementation on Jesus Rodriguez's blog. It has a great chart that details the ad-hoc communication that goes on in WS-Disco Using WS-Discovery in WCF 4.0

您可能会考虑,特别是如果你的消息在很大程度上是单向的,另一件事是,作品本身断开,就像MSMQ的协议。我不知道你的设计为您的应用程序看起来像,但MSMQ将允许客户端发送一个消息,无论在服务和服务将得到它的状态时,它回来了。这样你的客户没有阻止相当与其说试图得到确认服务达通信...它只会解雇,忘记了。

Another thing you might consider, especially if your messages are largely one-way, is a protocol that works natively disconnected, like MSMQ. I don't know what your design for your application looks like, but MSMQ would allow a client to send a message regardless of the state of the service and the service will get it when it comes back up. This way your client doesn't have to block quite so much trying to get confirmation that a service is up before communicating... it'll just fire and forget.

希望这有助于。

这篇关于如何检查的net.tcp WCF服务的可用性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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