Set Server. ScriptTimeOut executionTimeout for ASP. NET page request timeout,

Source: Internet
Author: User

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.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.