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.