Asp. NET page request Timeout time set up a variety of methods _ practical skills

Source: Internet
Author: User

asp.net

page Request Timeout (page daemon execution time) default value is 110 seconds (In the. NET Framework versions 1.0 and 1.1, the default value is 90 seconds)

That

server.scripttimeout =(httpserverutility.scripttimeout = 110)

System.Web.Configuration.HttpRuntimeSection (). Executiontimeout.tostring () =00:01:50(110 seconds)

method One: set the value of the Server.ScriptTimeout

Note: The value set must be greater than 90, or it will not take effect, the request timeout is still 90 seconds (online rumors, verified errors!!! )

This timeout property applies only if the Debug property in the compilation element is False (true:scripttimeout=30000000). To avoid shutting down the application during debugging, do not set this timeout property to a larger value.

<span style= "font-family: ' Microsoft Yahei ';" >//Unit seconds
Server.ScriptTimeout = 60;</span>

Method Two: Web.config configuration httpruntime executiontimeout (per second)

Note: This timeout property applies only if the Debug property in the compilation element is False (true:scripttimeout=30000000). To avoid shutting down the application during debugging, do not set this timeout property to a larger value.

httpRuntime executiontimeout settings to modify the value of the server.scripttimeout , setting the time-out values programmatically using the ScriptTimeout property takes precedence over the Web.config setting.

<span style= "font-family: ' Microsoft Yahei ';" ><system.web>
 <compilation debug= "false" targetframework= "4.0"/>
 <!--set to 600 seconds Server.ScriptTimeout =-->
 
 
   
Copy Code code as follows:
System.Web.Configuration.HttpRuntimeSection configsection = new System.Web.Configuration.HttpRuntimeSection ();
Configsection.executiontimeout = timespan.fromseconds (100);

method Four: IIS configuration modifies script timeout value

This indeterminate website → advanced settings:

Same uncertainty application pool → advanced settings:

Note: If the page uses a Updatepanel,updatepanel internal request, it is divided into two following situations:

The timeout value for the ① setting >=90 seconds, and the request time-out within UpdatePanel will change to 90 seconds!

The timeout value for the ② setting <90 seconds, and the request time-out within UpdatePanel changes to the value set!

The following figure server.scripttimeout= 5 seconds, click UpdatePanel inside the button, Thread.Sleep (20 * 1000) seconds, request timeout, but the page can not see the error message!

Click on the UpdatePanel external button, it will be reported as shown in Figure 1 "Request Timeout" error message!

Below figure server.scripttimeout= 100 seconds, click UpdatePanel inside the button, Thread.Sleep (95 * 1000)/stop 95 seconds; In fact, to 90 seconds to time out (as shown in the second figure) and click on the UpdatePanel external button, Thread.Sleep (95 * 1000)/Stop 95 seconds, request success!

=============================================================================================================== ======== Global Timeout time

If you have more than one Web site on the server, you want to set the timeout time uniformly, you need to set the Executiontimeout property value in the Machine.config file. The Machine.config file is located in the %systemroot%\microsoft.net\framework\%versionnumber%\config\ directory.

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.