你如何衡量一个Web服务调用的进展如何? [英] How do you measure the progress of a web service call?

查看:136
本文介绍了你如何衡量一个Web服务调用的进展如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET Web服务,做一些繁重的,喜欢说,有些文件操作,或者从一堆水晶报表生成Excel表。我不希望被阻止通过调用这个Web服务,所以我想使Web服务调用异步的。另外,我想从一个Web页面中调用这个Web服务,并希望一些机制,让我继续轮询服务器,这样我可以,我可以告诉的进步在屏幕上的一些指标的文件,就好说了,数了已经被处理。请注意,我不希望在网络上方法调用完成的通知,相反,我希望有一个活的进展情况。我要如何做呢?

I have an ASP.NET web service which does some heavy lifting, like say,some file operations, or generating Excel Sheets from a bunch of crystal reports. I don't want to be blocked by calling this web service, so i want to make the web service call asynchronous. Also, I want to call this web service from a web page, and want some mechanism which will allow me to keep polling the server so that i can i can show some indicator of progress on the screen, like say, the number of files that have been processed. Please note that i do not want a notification on completion of the web method call, rather, i want a live progress status. How do i go about it?

推荐答案

写,你可以通过传递已定,哪些作业的ID查询服务器上的一个单独的方法返回一个0到100之间的近似值(或0.0和1.0,或任何多远沿着它)。

Write a separate method on the server that you can query by passing the ID of the job that has been scheduled and which returns an approximate value between 0-100 (or 0.0 and 1.0, or whatever) of how far along it is.

例如。在REST风格,你可以做一个GET请求 http://yourserver.com/app/jobstatus/4133/ 这将返回一个简单的52为文本/纯。然后,你只需要查询每个(第二?2秒?10秒?)看多远沿着它。

E.g. in REST-style, you could make a GET request to http://yourserver.com/app/jobstatus/4133/ which would return a simple '52' as text/plain. Then you just have to query that every (second? two seconds? ten seconds?) to see how far along it is.

您实际上如何实现监控的后端巨大取决于你的过程以及它是如何工作的。

How you actually accomplish the monitoring on the backend hugely depends on what your process is and how it works.

这篇关于你如何衡量一个Web服务调用的进展如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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