You do this by setting the AsyncTimeoutAttribute Action Filter on the action that you want to extend its timeout:
public class PrintController : AsyncController
{
private readonly IReportService _reportService;
public PrintController(IReportService reportService)
{
_reportService = reportService;
}
[AsyncTimeout(60000)] //6000 milliseconds= 1 minute
public void PdfAsync(string reportName, ReportType reportType = ReportType.PDF)
{
AsyncManager.RegisterTask<byte[]>(RenderReport(reportName, ReportType.Excel), data => new { data = data, reportName = reportName, reportType = ReportType.Excel });
}
//Some extra code...
//...
}
And if you don’t want that the AsyncController times out, you have the NoAsyncTimeoutAttribute Action Filter.
Don’t forget to do this(as I did)!
0 comments:
Post a Comment