Global timeout
If you have multiple websites on the server and want to set the timeout time in a unified manner, you need to set the ExecutionTimeout attribute value in the Machine. config file.
The Machine. config file is located in the % SystemRoot % \ Microsoft. NET \ Framework \ % VersionNumber % \ CONFIG \ directory.
For example:
Copy codeThe Code is as follows:
<HttpRuntime executionTimeout = "90" maxRequestLength = "4096" timeout = "false" minFreeThreads = "8" minLocalRequestFreeThreads = "4" appRequestQueueLimit = "100"/>
Time-out period of a single site
Set the http request runtime in the Web. config configuration file:
Copy codeThe Code is as follows:
<System. web>
<HttpRuntime maxRequestLength = "102400" executionTimeout = "720"/>
</System. web>
The value is set to 720 seconds. The preceding maxRequestLength attribute is generally used to limit the size of uploaded files! The default value is generally 4096 KB (4 MB ).
Single page request timeout
For a single page, you can use Server. ScriptTimeout to set the timeout.
Copy codeThe Code is as follows:
Server. ScriptTimeout = 120;
Note: If the debug attribute is set in Web. config, for example, <compilation debug = "true" targetFramework = "4.0">
In this case, ScriptTimeout is ignored.