Set Server. ScriptTimeOut executionTimeout for ASP. NET page request timeout,
ASP. NET page request timeout (page background program execution time) The default value is 110 seconds (In. NET Framework 1.0 and 1.1, the default value is 90 seconds.)That is:Server. ScriptTimeout = 110(HttpServerUtility. ScriptTimeout = 110)System. Web. Configuration. HttpRuntimeSection (). ExecutionTimeout. ToString () =00:01:50(110 seconds) Method 1: Set Server. note: The value of ScriptTimeout must be greater than 90, otherwise it will not take effect, and the request timeout value is still 90 seconds (a verification error has been reported on the Internet !!!) Only whenCompilationThe debugging attribute in the element isFalseThis timeout attribute is only applicable (true: ScriptTimeOut = 30000000 ). To avoid disabling the application during debugging, do not set this timeout attribute to greater than timeout.
// Unit: Server. ScriptTimeout = 60;
Method 2: Configure httpRuntime executionTimeout in seconds in Web. config)
Note: Only when
CompilationThe debugging attribute in the element is
FalseThis timeout attribute is only applicable (true: ScriptTimeOut = 30000000 ). To avoid disabling the application during debugging, do not set this timeout attribute to greater than timeout.
HttpRuntime executionTimeoutCan be modified
Server. ScriptTimeoutValue, use
ScriptTimeoutThe attribute is set programmatically to take precedence over the timeout value
Web. config.
<System. web> <compilation debug = "false" targetFramework = "4.0"/> <! -- Set to 600 seconds Server. ScriptTimeout = 600 --> Method 3: set the value of HttpRuntimeSection. ExecutionTimeout (
Tested, invalid !!! I do not know how to use it!) Https://msdn.microsoft.com/zh-cn/library/system.web.configuration.httpruntimesection.executiontimeout (VS.80). aspx
System.Web.Configuration.HttpRuntimeSection configSection = new System.Web.Configuration.HttpRuntimeSection();configSection.ExecutionTimeout = TimeSpan.FromSeconds(100);
Method 4: IIS configuration modification script timeout value: unconfirmed website → Advanced Settings: Same as unconfirmed application pool → advanced settings:
NOTE: If UpdatePanel is used on the page, the internal requests of UpdatePanel are divided into the following two situations:
①
The set timeout value is greater than or equal to 90 seconds,
Internal UpdatePanel
The request timeout value will change to 90 seconds!
② Set the timeout value <90 seconds,
Internal UpdatePanel
The request timeout value will be changed to the set value!Server. ScriptTimeout = 5 seconds. Click the internal button of UpdatePanel. Thread. Sleep (20*1000) seconds. The request times out, but the error message is not displayed on the page! When you click the UpdatePanel button, the error message "request timeout" of 1 is returned! Server. scriptTimeout = 100 seconds, click the internal button of UpdatePanel, Thread. sleep (95*1000) // stop for 95 seconds. In fact, it times out after 90 seconds (as shown in the second figure below). Click the external button of UpdatePanel, Thread. sleep (95*1000) // stop for 95 seconds. The request is successful! ========================================================== ========================================================== ========================================================
Global timeoutIf 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.