When you query data in the company background, if the selected period is too long, you will encounter a "request timeout" problem.
The reasons for this problem are as follows:
1. Asp.net request timeout
2. WebService request timeout
3. IIS request timeout
4. Database Connection timeout
After knowing the cause, you can solve the problem.
Timeout settings in Asp.net:
Add the following code to the <system. Web> node in Web. config:
[CSHARP] [/CSHARP]
Explanation from msdn:
Httpruntime is used to configure ASP. net http runtime settings to determine how to process requests to ASP. NET applications.
Executiontimeout: maximum time limit allowed for request execution. The unit is maxrequestlength (in seconds): indicates the maximum file upload size supported by ASP. NET. This restriction can be used to prevent DoS attacks caused by a large number of files being transferred to the server. The specified size is in KB. The default value is 4096 KB (4 MB ).
WebService request timeout settings:
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.
Set Request timeout in IIS.
IIS-website-attribute connection timeout time: 1200 seconds
Database Connection (ado.net) Timeout
1. It may be because the connection pool (Connection pooling) is used up and the connection pool needs to be expanded.
2. Set a longer timeout time (timeout attribute) for sqlcommand ).
[CSHARP] sqlcommand mycommand = new sqlcommand (); mycommand. commandtimeout = 15; [/CSHARP]
3. The ado.net timeout is complicated. It may also be caused by table locking or other reasons.
After question: there should be a similar solution to the "request timeout" issue in other development platforms (JSP, PHP. For example, if you set Apche and tomcat, the timeout time is longer.
This article is also published in: http://www.2evening.info/archives/asp-net-webservice-timeout.html