Set the run timeout for ASP.NET pages to detail to individual pages and sites

  • 2020-12-18 01:48:18
  • OfStack

Global timeout

If there are multiple websites on the server and you want to set the timeout under 1, you need to set the value of the ExecutionTimeout attribute in the Machine.config file.
The Machine.config file is located in the %SystemRoot%\ Microsoft.NET \Framework\%VersionNumber%\CONFIG\ directory.
Such as:

 
<httpRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" /> 

Individual site timeouts

Web. config configuration file to set http request runtime:
 
<system.web> 
<httpRuntime maxRequestLength="102400" executionTimeout="720" /> 
</system.web> 

This is set to 720 seconds. The previous property maxRequestLength1 is generally used to limit the size of a user's uploaded file! Default 1 is 4096 KB (4 MB).

Timeout for a single page request

For a single page, you can use Server.ScriptTimeout to set timeouts.
 
Server.ScriptTimeout = 120; 

Note: If the debug attribute is set in ES39en.config, for example: < compilation debug="true" targetFramework="4.0" >
At this point, ScriptTimeout is ignored.


Related articles: