简体   繁体   English

使用WCF Duplex回调更新JQuery进度条?

[英]Update a JQuery progressbar using WCF Duplex callbacks?

I have a fairly straightforward WCF duplex service hosted on IIS (.NET 4.x) 我在IIS(.NET 4.x)上托管了一个非常简单的WCF双工服务

One particular service method is long running (1-3 minutes), and when this method is triggered by the client, I would like to provide visual feedback to the user via a JQuery progressbar on the page that updates based on an integer value passed during multiple callbacks. 一种特定的服务方法是长时间运行(1-3分钟),当客户端触发此方法时, 我想通过页面上的JQuery进度条向用户提供视觉反馈,该进度条基于在此期间传递的整数值进行更新多个回调。

I am open to moving away from a duplex implementation, but it seemed like the logical approach at the time... 我愿意摆脱双工实施,但它似乎是当时的逻辑方法......

What is the best way to go about this, keeping in mind that I would like to minimize overhead, and also avoid introducing more technologies like silverlight (though I realize this is a perfectly viable solution for this problem). 什么是最好的方法,记住我想尽量减少开销,并避免引入更多的技术,如silverlight(虽然我意识到这是一个非常可行的解决方案)。

Specifically, some code examples might be helpful. 具体来说,一些代码示例可能会有所帮助 Also note that I am new to both JQuery and WCF. 另请注意,我是JQuery和WCF的新手。

I wasn't sure what other information to offer to make this question more clear, so if you require more information, please ask and I will amend the original question. 我不确定提供哪些其他信息可以使这个问题更清楚,所以如果您需要更多信息,请询问我将修改原始问题。

This is not feasible using standard WCF without moving to Silverlight as you would need to use a polling duplex channel at the browser. 如果不移动到Silverlight,使用标准WCF是不可行的,因为您需要在浏览器中使用轮询双工通道。

There was an AJAX implementation of the client side of the PollingDuplex protocol done some time ago , which would allow you to have your client progress bar update in response to progress updates from the server (sort of - it still needs the client to poll). 一段时间之前PollingDuplex协议的客户端一个AJAX实现 ,这将允许您更新客户端进度条以响应来自服务器的进度更新(有点 - 它仍然需要客户端轮询)。 Not sure if it works with the latest version of PollingDuplex. 不确定它是否适用于最新版本的PollingDuplex。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM