[英]Does MSoft provide a persistent client-side error reporting for server-side errors plugin or tool to use with MVC3 applications?
I'm working on an application which contains significant server-side data manipulation and work. 我正在开发一个包含大量服务器端数据处理和工作的应用程序。 I would like to provide constant status updated and error reports related to this work, to the client.
我想向客户提供有关此工作的持续状态更新和错误报告。
The client might, for example, fire off a job or batch of jobs running server side, based on some data he uploaded. 例如,客户端可以根据他上载的某些数据来触发运行服务器端的一项或多项作业。 Then he might proceed to do other work on the site, while the jobs continue to run.
然后,在作业继续运行的同时,他可能会继续在该站点上执行其他工作。
Does MSoft provide a nice tool for showing status updates and error reports to the client? MSoft是否提供了一个很好的工具来向客户端显示状态更新和错误报告? I imagine some sort of polling javascript app, or maybe a pre-defined subform etc.., that could sit in a footer or be dynamically loaded over a corner of the screen when appropriate.
我想象一种轮询的javascript应用程序,或者是预定义的子窗体等,它们可以位于页脚中,或者在适当的时候动态地加载到屏幕的一角。
Come to think of it, I'd probably be happy with any other implementation of this kind of tool, as long as it's up to date and sees lively support. 想到这一点,我可能会对这种工具的任何其他实现感到满意,只要它是最新的并且能看到活跃的支持即可。
I had a similar requirement to refresh reports and went down the asynchronous controller route until I realized the limitations. 我有类似的要求来刷新报告,并沿异步控制器路由,直到意识到限制为止。 I decided to implement a solution that registers the report refresh from the ASP.NET MVC3 application and made a Windows Service that polls requests every 2 minutes for processing.
我决定实现一个解决方案,该解决方案注册来自ASP.NET MVC3应用程序的报表刷新,并创建了Windows服务,该服务每2分钟轮询一次请求进行处理。
View 视图
$("#btnRefresh").live("click", function(e) {
$.ajax({
type: "POST",
url: '@Url.Action("Refresh")',
data: "reportId=@Model.Id"
})
.done(function(message) {
alert(message);
})
.fail(function(serverResponse) {
alert("Error occurred while processing request: " + serverResponse.responseText);
});
e.preventDefault();
});
Controller Action 控制器动作
[HttpPost, VerifyReportAccess]
public ActionResult Refresh(Guid reportId)
{
string message;
try
{
message = _publisher.RequestRefresh(reportId);
}
catch(Exception ex)
{
HttpContext.Response.StatusCode = (Int32)HttpStatusCode.BadRequest;
message = ex.Message;
}
return Json(message);
}
Repository 资料库
public string RequestRefresh(Guid reportId)
{
var scheduledReport = _repository.GetScheduleForReport(reportId);
if (scheduledReport.CompanyId == Guid.Empty)
throw new Exception("Requested Report Not Found");
if(_repository.CheckPendingRefresh(scheduledReport))
return "A request to refresh this report is already pending.";
_repository.ScheduleReportRefresh(scheduledReport);
return "A request to refresh the report has been submitted. The report will appear online when available.";
}
The windows service runs the same class library code as the nightly ETL process to refresh the report. Windows服务运行与夜间ETL进程相同的类库代码,以刷新报告。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.