简体   繁体   English

ASP.NET在SQL中将报表排队并在可用时更新用户的最佳方法

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

I want to allow users on the website to queue a report (enter the request in a sql table). 我想允许网站上的用户将报告排队(在sql表中输入请求)。 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. Windows应用程序将处理该队列,该应用程序将从sql服务器读取队列,运行报告,并更新记录中的reportcomplete字段。 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. 我玩弄了SQLDependency,可以触发onchange事件,但是当然我无法回到已经在浏览器中加载的页面。 Pretty much out of ideas on how to accomplish this, and I'm thinking SQLDependency might be the wrong avenue. 关于如何完成此操作的想法几乎不存在,我认为SQLDependency可能是错误的途径。 Any ideas? 有任何想法吗?

HTTP cannot connect back to the client. HTTP无法连接回客户端。 The only solution is to for the client to poll, usually via a long tail (eg. Comet Ajax ) request. 唯一的解决方案是通常通过一条长尾巴(例如Comet Ajax )请求让客户端进行轮询。 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. 因此,原始页面请求返回,脚本在结果页面上启动,并发布一个后台请求,该后台请求输入ASP.Net代码并阻止事件。 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. SQLDependency通知事件,因此长尾请求重新激活并将响应返回给代理,该代理现在完成Ajax调用并可以更新页面。 At least this is the 10000 ft. view. 至少这是10000英尺的视图。 This will work, but won't scale (primarily because of the resources tied up by the Ajax request, the blocked ASP.Net processing thread). 这将起作用,但不会扩展(主要是由于Ajax请求(阻塞的ASP.Net处理线程)占用了资源)。 More scalable approaches exists, but are significantly more complex. 存在更多可扩展的方法,但是要复杂得多。

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

相关问题 从ASP.net Web应用程序更新员工Sql表的最佳用户界面方法 - Best User Interface way to update an employees Sql table from an ASP.net web application 在ASP.NET中检查用户浏览器的最佳方法是什么? - What is the best way to check the user's browser in ASP.NET? 在ASP.NET中执行SQL的最佳方法 - Best way to perform SQL in ASP.NET 在ASP.Net中将报告打印为PDF的最佳方法是什么? - What is the best way to print a report to PDF in ASP.Net? 在 asp.net core 中生成报告的最佳方式是什么? - What is the best way to produce the report in asp.net core? 如果有太多用户使用c#使用asp.net访问sql中的那个表,那么更新表的最佳方法是 - Best way to update table if too many users access that table in sql with asp.net using c# 更改架构后更新我的asp.net应用程序/数据库的最佳方法是什么? - What's the best way to update my asp.net application / database after changing the schema? 在 asp.net 中显示来自 sql 服务器数据库的图像的最佳方式是什么? - What's the best way to display an image from a sql server database in asp.net? 在asp.net中更新输出值的最佳方法(数据库和标签) - Best way to update an out value in asp.net (DataBase & Label) Asp.Net MVC更新缓存表的最佳方法 - Asp.Net MVC best way to update cached table
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM