Summary of Asp. Net timeouts

Source: Internet
Author: User
Tags connectionstrings

 
During database or request operations, if the selected time period is too short or the operation data volume is too large, the "request timeout" problem will occur. There are many solutions available on the network, but they are generally not perfect, based on your personal experience and Network Solutions, first summarize them as follows:

The error types are roughly divided into the following situations:
1: Asp.net request timeout
2: IIS request timeout
3: database connection timeout
4: database operation timeout
5: application pool recycling (low)
6: Webservice and other service request timeout

We will handle the problem one by one based on the above situations.
1: Asp.net request timeout
Http request timeout can be configured globally in webconfig (unit: seconds, default: 90 seconds) as follows
<System. web>
<HttpRuntime maxRequestLength = "102400" executionTimeout = "180"/>
System. web>

2: IIS request timeout
Go directly to IIS to set: IIS-website-attribute to set a large value, but it cannot be too large. The specific situation is analyzed.

3: database connection timeout
Configure database connection strings together
<ConnectionStrings>
<Add name = "MarketingMate" connectionString = "Data Source = 192.168.1.1; Database = MarketingMate; User Id = sa; Password = 123; Connect Timeout = 30; Min Pool Size = 16; max Pool Size = 100 ;"
ProviderName = "System. Data. SqlClient"/>
ConnectionStrings>

4. Database Operation timeout
Currently, no global setting method is available for database operation timeout. You can only set the CommandTimeOut attribute of the Command class (unit: seconds, default value: 30 seconds)
Context. CommandTimeout = 180;

5: application pool recycling (bottom) is very low. Set it as appropriate.
The application pool recycles the thread within a certain period of time. You can directly set it to: application pool -- properties -- Recycle Worker Process

6: Webservice and other service request timeout (this is a solution provided on the Internet, I have never met)
Extend the timeout limit of the proxy class. The default value is 90 seconds. That is, specify the timeout before calling the method.
[Csharp] YourWebService yws = new YourWebService (); yws. Timeout = 1200000; // 20 minutes, in milliseconds [/csharp]
If the Timeout attribute is set to Timeout. Infinite, the request does not time out. Even if the XML Web services Client can set the Timeout attribute to no Timeout, the Web server can still time out the request on the server side.

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.