We ran into a problem with an ASP.NET web application written in C# which is built with Web Forms (.ASPX pages). There are some long running requests in this system which take about 10-15 minutes. This is normal due to the heavy SQL queries and calculations that are running at the background. This is an old system and this have never been a problem over the years. Some time ago a couple of users started complaining that they cannot download those reports which take more than 10 minutes to run. Technically they run the report by hitting a button on the page which performs a post back to the server where the report is generated and when the file is ready the server returns it to the client where the “save file” dialog appears (depending on the browser). Unfortunately, those users don’t get the “save file” dialog and the file never appears in the browser and the page seems to be loading forever.
As I said, we have never seen this issue before (the system has been hosted on different servers over the years). We are unable to reproduce the problem in our local development environment. What is most interesting is the fact that we cannot reproduce the problem when we try running the same report from our personal computers which are outside of the client’s corporate AD domain network. However, we can reproduce the problem when running sample requests in Postman.
Here is a short summary of when the problem can be reproduced and when everything works fine:
- Server = [production server, IIS 10, Windows Server 2019]; Client = [Any browser (either Chrome or Edge) when this is a workstation in the client’s corporate AD domain network]; Problem appears => YES
- Server = [production server, IIS 10, Windows Server 2019]; Client = [Any browser (either Chrome or Edge) when this is a computer OUTSIDE the corporate AD domain network]; Problem appears => NO
- Server = [production server, IIS 10, Windows Server 2019]; Client = [Postman OR sample C# console application making HTTP requests OR PowerShell script when the client computer is OUTSIDE the corporate AD domain network]; Problem appears => YES
- Server = [development machine, IIS 10, Window 10]; Client = [Any browser (either Chrome or Edge) from a computer OUTSIDE the corporate AD domain network]; Problem appears => NO
We did various experiments and it seems that this problem appears in different use cases as follows:
- Do a post-back to the .ASPX page and reload some content on the screen
- Do a post-back and return a file attachment (the “save file” dialog in the browser)
- Sample page which just returns some plain text as a response
We found that in all those cases the problem appears if the HTTP request takes more than 240-250 seconds.
The problem is that no error appears and we cannot see any indication neither in browser’s DevTools (F12) nor in Postman nor in Fiddler. It just looks like as if the request hangs and remains “pending” forever.
All “timeout” settings that we know on the server are long enough. For example, the ASP.NET session timeout is 60 minutes, the httpRuntime is configured with executionTimeout=3600, the Application Pool Idle Time-out is set to 0.
It just looks like that if the HTTP request takes more than 240-250 seconds then the connection hangs and it happens only for some clients. Just to clarify, the process on the server completes every time and it performs all tasks without any problems.
Some time ago we did an experiment and it seems the problem doesn’t appear if the server periodically sends something to the client by using Response.Write() and Response.Flush() while the long HTTP request is still running but we cannot use this workaround when the server sends a file attachment back to the browser. Also, in addition to finding a workaround we are trying to understand what is the cause of this issue and we are looking for some kind of a server setting that we can use to control this behavior.
Any ideas?