[英]Does MSoft provide a persistent client-side error reporting for server-side errors plugin or tool to use with MVC3 applications?
我正在開發一個包含大量服務器端數據處理和工作的應用程序。 我想向客戶提供有關此工作的持續狀態更新和錯誤報告。
例如,客戶端可以根據他上載的某些數據來觸發運行服務器端的一項或多項作業。 然后,在作業繼續運行的同時,他可能會繼續在該站點上執行其他工作。
MSoft是否提供了一個很好的工具來向客戶端顯示狀態更新和錯誤報告? 我想象一種輪詢的javascript應用程序,或者是預定義的子窗體等,它們可以位於頁腳中,或者在適當的時候動態地加載到屏幕的一角。
想到這一點,我可能會對這種工具的任何其他實現感到滿意,只要它是最新的並且能看到活躍的支持即可。
我有類似的要求來刷新報告,並沿異步控制器路由,直到意識到限制為止。 我決定實現一個解決方案,該解決方案注冊來自ASP.NET MVC3應用程序的報表刷新,並創建了Windows服務,該服務每2分鍾輪詢一次請求進行處理。
視圖
$("#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();
});
控制器動作
[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);
}
資料庫
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.";
}
Windows服務運行與夜間ETL進程相同的類庫代碼,以刷新報告。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.