问题描述
我们可以使用轮询从某些来源(例如,连接到Web服务器的客户端)中查找有关更新的信息. WCF以双工合同的方式提供了一个漂亮的功能,在该功能中,我可以维护与客户端的连接,并可以随意对该连接进行调用.办公室的一些偷窥者正在讨论这两种解决方案的优点,我想就何时最佳使用每种策略获得反馈.
We can use polling to find out about updates from some source, for example, clients connected to a webserver. WCF provides a nifty feature in the way of Duplex contracts, in which, I can maintain a connection to a client, and make invocations on that connection at will.Some peeps in the office were discussing the merits of both solutions, and I wanted to get feedback on when each strategy is best used.
推荐答案
我将使用基于事件的机制来代替轮询.在WCF中,您可以按照Juval Lowy在他的网站 IDesign.net .
I would use an event-based mechanism instead of polling. In WCF, you can do this easily by following the Publish-Subscribe framework that Juval Lowy provides at his website, IDesign.net.
这篇关于轮询或不轮询(在Web服务上下文中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!