开发者

ASP.NET Best way to queue a report in sql and then update the user when it's available

I want to allow user开发者_Python百科s on the website to queue a report (enter the request in a sql table). The queue will be processed by a windows app that will read the queue from the sql server, run the reports, and update the reportcomplete field in the record. I need to be able to post a message saying something similar to "Generating report" and then alert the user when the report is available. I have toyed with SQLDependency and I can get the onchange event to fire, but of course I can't get back to the page that has already loaded in the browser. Pretty much out of ideas on how to accomplish this, and I'm thinking SQLDependency might be the wrong avenue. Any ideas?


HTTP cannot connect back to the client. The only solution is to for the client to poll, usually via a long tail (eg. Comet Ajax) request. So the original page request returns, a script starts on the result page and posts a background request that enters the ASP.Net code and blocks on an event. The SQLDependency notifies the event, so the long tail requests re-activates and returns the response to the agent, which now completes the Ajax call and can update the page. At least this is the 10000 ft. view. This will work, but won't scale (primarily because of the resources tied up by the Ajax request, the blocked ASP.Net processing thread). More scalable approaches exists, but are significantly more complex.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜