Summary of ASP. NET timeout issues

Source: Internet
Author: User

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. ApplicationProgramPool recycling (low)

6: WebService and other service request timeout

7. Other reference URLs

 

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.

 

7. Other reference URLs

Someone said that setting the Web. config configuration solution for the sessionstate node can also be resolved, if the solution in the above 6 cannot be resolved, please refer to the following URL http://blog.sina.com.cn/s/blog_46682add0100axtf.html

 

 

The above is purely a personal opinion. For more information, see the source.

-------------- AK: 2012-09-05

 

 

 

 

 

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.