ASP.Net request raises 502 Bad Gateway or TimeOut

2019-07-27 10:08发布

问题:

I have a C# ASP.NET Webforms website running on IIS7. It is a report creation application that queries the SQL Server database, gets the data, parses it in to an Excel document.

The query itself doesn't take too long, but writing to the Excel takes a while when the query is very large (50,000 rows).

Now for the problem, when I run the report app, I get the report with in a few minutes but when some users run it, the report returns 502 Bad Gateway. This only happens for large reports.

I assume that it has to do with a timeout? Even though no matter which timeout command I change, the gateway error comes up with in two minutes.

回答1:

The issue had to do with memory and we had to change the architecture. Since then, we have moved to dedicated report servers and split the reports into different parts (i.e different time frames) and combined them again once each report is done. This can easily be achieved via Azure Queue and Blob Storage. The reports are also emailed instead of returned back in an HTTP call.