我正在尝试生成报告并在Excel中下载。 如果返回的结果很大,则操作需要很长时间,我会收到错误消息。
HTTP错误502.3 - 错误网关
指定的CGI应用程序遇到错误和服务器 终止了这个过程。
public IActionResult GenerateReport(ReportDateRangeViewModel model)
{
var objections = _reportService.ReportGet(model.StartDate, model.EndDate);
string sWebRootFolder = _hostingEnvironment.WebRootPath;
string sFileName = @"Report.xlsx";
string URL = string.Format("{0}://{1}/{2}", Request.Scheme, Request.Host, sFileName);
FileInfo file = new FileInfo(Path.Combine(sWebRootFolder, sFileName));
if (file.Exists)
{
file.Delete();
file = new FileInfo(Path.Combine(sWebRootFolder, sFileName));
}
using (ExcelPackage package = new ExcelPackage(file))
{
//Do some mapping to excel doc
}
return Redirect(URL);
}
有没有办法延长此控制器操作的超时?