获取有关在 WCF 中花费很长时间的方法的进度信息的有效模式? [英] Effective pattern for getting progress info about a method that takes a long time in WCF?

查看:45
本文介绍了获取有关在 WCF 中花费很长时间的方法的进度信息的有效模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取有关在 WCF 上调用的方法的进度更新.

I want to get progress updates about a method called on WCF.

例如,我运行了 1000 次查询并想知道当前状态.

For example I run 1000 queries and want to know the current status.

推荐答案

如果双工合同在您的环境中不可行,您将不得不求助于轮询.您的初始方法可以返回一个标识符(也许是 GUID),然后您可以随后调用另一个方法来检查进度,并传入标识符.

If a duplex contract is not workable in your environment, you will have to resort to polling. Your initial method could return an identifier (a GUID perhaps) and then you could make subsequent calls to another method to check the progress, and pass in the identifier.

这显然需要您将进度信息存储在某个地方(例如会话或数据库),这不太好.

This will obviously require you to store the progress information somewhere (like a session or a database), which is not great.

这篇关于获取有关在 WCF 中花费很长时间的方法的进度信息的有效模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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