Iis – ASP.NET MVC Getting Error 504 after 10 minutes of File Upload

asp.net-mvciissql-server-2008-r2timeoutweb.config

I have an ASP.NET MVC2 Web application, working with SQL Server 2008 R2, running with IIS 6.2. I have a functionality where one particular admin needs to upload about 5000 documents, which then get to be processed and stored in the server, while their names are saved in a database.

Problem is, on the client side, 10 minutes after the file upload begins, I get: Error 504 Timeout, Gateway Timeout. I changed the httpRuntime.ExecutionTimeout value in the web.config but it didn't solve the problem.

Does anyone know where is the value limiting me stored?

Here's my web.config file: http://pastebin.com/VXs0BFTp

EDIT: Also, after the Error 504 is received, the data storage in the database keeps going anyways.

Best Answer

From your description it seems that your client -> Web server connection timeouts are most probably related to a proxy usage. If your server processes the files in more than 10 minutes, your client does not receive a response in a timely fashion, but the Web server can process further.

httpRuntime.ExecutionTimeout specifies how much an IIS thread is allowed to process a request before being shut down, so it should not have any influence for your problem.

If you cannot optimize your server side processing for the files, my suggestion is a redesign. One possible way is to upload all the files, respond to the client as soon as possible and have the processing asynchronously. Of course, the client UI should be changed to be able to display the status of the processing (e.g. in percents).

If the upload process is taking too much (i.e. minutes), a solution might be to have the admin transfer the files to a network location and start the processing after doing that (Web Server should have the rights to read from that location). It is not very user friendly, but admins are not regular users.