Browser timeouts while asp.net application continues to work

I encounter a situation where ASP.NET takes a long time to respond to a web page (more than 2 hours). This is because codebehind has been running for a while (a very long, slow cycle).

The browser (both IE and Firefox) stops waiting for a response (after about an hour) and gives a general one that cannot display a web page error (similar to what you see if you try to go to a non-existent server).

At the same time, the asp.net application continues to work (I see it in the debugger) and eventually shuts down.

Why is this happening? Are there any settings in web.config to affect this? I hope you will have a timeout that I am missing that causes this.

Maybe settings in IE or Firefox? But I think they are waiting for the server to communicate.

I experience this even when I run the application in debug mode (with debug = "true" compilation) on my local computer from VS (therefore it does not work in IIS, but on ASP.NET Dev Server).

I donโ€™t know that it takes a lot of time to create a page, but at this stage it does not matter. Speeding up this will require a lot of extra work, and delaying is not a big deal. It is used internally.

I understand that I can redo this problem by logic in the background process and receive a notification when this is done through AJAX, or pull it to a desktop application or service or something else. Something in this direction will be done in the end, but that is not what I am asking for right now.

+2
timeout
Mar 11 '09 at 2:08
source share
4 answers

It looks like you are using IE and it is shutting down, waiting for a response from the server.

You can find a technical article to configure this limit:

http://support.microsoft.com/kb/181050

CAUSE

By design, Internet Explorer imposes a timeout limit for the server to return data. The timeout limit is five minutes for versions 4.0 and 4.01 and is 60 minutes for versions 5.x, 6, and 7. As a result, Internet Explorer does not wait endlessly for the server to return with data when the server has a problem. Go to the top of the page

Decision

In general, if the page does not return within a few minutes, many users believe that a problem has occurred and stopped processing. Therefore, create your server processes for returning data within 5 minutes, so that users do not have to wait a long time.

+5
Mar 11 '09 at 2:20
source share

The whole Web paradigm is request / response. Do not request, wait two hours, answer!

If the work takes a lot of time, then the page request starts the work, and then does not wait for it. Put the long code in the Windows service and ask the service to listen on the MSMQ queue (or use WCF with the MSMQ endpoint). Ask the page to send job requests to this queue. The service will read the request, possibly start a new thread to process it, and then write the response to another queue, file or something else.

On the same page or on another โ€œprogressโ€ page, you can poll the response queue or answer file and update the user, assuming that the user still cares after two hours.

+3
Mar 11 '09 at 2:17
source share

For something that takes a lot of time, I would figure out a way to drop it through AJAX, and then periodically check its status. The background process should regularly update some status variable and store it in a cache or session upon completion. When it is completed and the browser detects this (via AJAX), the browser will do a real postback (or change location.href), take the saved data and generate the page.

+2
Mar 11 '09 at 2:17
source share

I have a process that can take several minutes, so I select a separate thread and send the result via ftp. If an error occurs in the process, I send an error message, including a stack trace. You may want to send the results by email or to another place, and then to the browser and use the stream.

0
May 08 '09 at 2:25 pm
source share



All Articles