In one of our application we want our user to upload data up to 1GB and the most interesting part is we want this uploading via HTTP. I mean, we have plan to use FTP but that is for future. For now we need to make it with HTTP.
Off course, uploading data in GB’s requires much extra time then the default configuration and same problem with the request size. So, to make it done we need to change the configuration of following items.
- executionTimeOut : Default value is 110 seconds, we need to make it for at least 12 hours.
- maxRequestLength : Default value is 4096 KB (4 MB), we want it to accommodate 1 GB size of data.
- Session Timeout : Default value is 20 minutes, we need to make it according to the executionTimeOut.
The above two are the configuration of httpRuntime attribute, but along with that why do we need to change the session timeout. Because, if session timeout is less then execution timeout it means when the request finishes its processing meanwhile, the session get’s end which can raise an error.
So, here is the configuration which we need to make in web.config.
1: <httpRuntime executionTimeout="43200" maxRequestLength="104856" />
2: <sessionState mode="InProc" cookieless="false" timeout="720"/>
Notice, executionTimeout needs to be filled in seconds where as timeout of sessionstate needs minutes as input.
But that doesn’t work in my case. I spent many hours replacing the configuration settings and no results.
Finally, I get to know that Application Pool also have idle timeout settings which can be useful.
To get application pool in Windows 2003 :
- Right click on your website and click properties
- Then Home Directory Tab and notice the last most drop down of screen. Application Pool
- Notice the name, and close screen.
- Then go to Application Pools right click the application name which you have in our website and then properties. You will see the following Screen.
The default value of idle timeout is 20 minutes. I have changed this to 720 (same as of session) minutes and every thing start working.
I did never even hear of this idle timeout before neither I think that while uploading the file connection thread is idle but now this is for sure, if you are increasing the session timeout greater then 20 you must need to configure the same amount in your Application Pool Settings.