处理长时间运行报告 [英] Handling Long Running Reports

查看:152
本文介绍了处理长时间运行报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作写在C#与SQL Server 2000数据库中的ASP.net应用程序。我们有哪些客户端使用他们的业务需要几个PDF报告。问题是,这些报告需要一段时间才能产生(> 3分钟)。当用户请求的请求超时杀死请求的Web服务器有时间来完成生成报告之前的报告,使用户永远不会得到一个机会来下载文件通常是什么最终发生的是。然后,用户将刷新页面,然后再试一次,这在开始整个报表生成过程及最终还是超时。 (不,我们没有缓存报道,现在,那是后话,我竭力推动...)。

I am working on a ASP.net application written in C# with Sql Server 2000 database. We have several PDF reports which clients use for their business needs. The problem is these reports take a while to generate (> 3 minutes). What usually ends up happening is when the user requests the report the request timeout kills the request before the web server has time to finish generating the report, so the user never gets a chance to download the file. Then the user will refresh the page and try again, which starts the entire report generation process over and still ends up timing out. (No we aren't caching reports right now; that is something I am pushing hard for...).

你是如何处理这些情况?我有我的头一个想法,包括作出aysnchronous请求开始生成报告,然后有一些JavaScript定期检查状态。一旦状态表明报告完成然后进行实际的文件一个单独的请求。

How do you handle these scenarios? I have an idea in my head which involves making an aysnchronous request to start the report generating and then have some javascript to periodically check the status. Once the status indicates the report is finished then make a separate request for the actual file.

有没有一种简单的方法,我没有看到?

Is there a simpler way that I am not seeing?

推荐答案

在这里使用的文件系统可能是一个不错的选择。有立即返回一个URL报告PDF位置的请求。然后,您的服务器可以揭开序幕外部进程或发送请求给自己来执行报告。客户端可以轮询服务器(使用HTTP HEAD)为PDF在所提供的URL。如果您的PDF的文件名来源于报表参数,通过使用散列或者直接把参数到名称,你会得到即时的服务器端缓存了。

Using the filesystem here is probably a good bet. Have a request that immediately returns a url to the report pdf location. Your server can then either kick off an external process or send a request to itself to perform the reporting. The client can poll the server (using http HEAD) for the PDF at the supplied url. If you make the filename of the PDF derive from the report parameters, either by using a hash or directly putting the parameters into the name you will get instant server side caching too.

这篇关于处理长时间运行报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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