Timeout timeout time has expired. The timeout period has expired or the server is not responding before the operation completes

Source: Internet
Author: User

Timeout time has expired. The timeout period has expired or the server is not responding before the operation completes

Problem

When querying data using an ASP. NET-developed application, the page request time is too long and the timeout time is returned. When the time-out between operations completes or the server is not responding "

Analysis

The cause of this problem is probably the following points:
1.asp.net Request timed out
2.Webservice Request timed out
3.IIS Request timed out
4. Database connection Timeout

Based on experience, it should be the database connection time-out, according to the solution found on the Internet, the following attempts

Add the connection string Connect Timeout

Add connect timeout=500 after the database connection string (connection time-out is set to 500 seconds)

SqlConnection con = new SqlConnection ("server=.; Database=mydb;uid=sa;pwd=password; Connect timeout=500 ")

After running the query for less than 30 seconds and still returning a timeout timeout, the issue is not resolved

Set Command object Properties CommandTimeout

SqlCommand cmd = new SqlCommand (); cmd.commandtimeout = 180;

Run, you can solve the command execution time-out problem, here set the time of 180 seconds, can be set according to need, if too long, can also be set to 0, set to 0 means unlimited time, this property value should be used with caution. You also need to set the HTTP request run time limit in the Web. config configuration file

<system.web> 

Set here for 720 seconds, the front property maxRequestLength is generally used for user upload file limit size! The default is typically 4096 KB (4 MB).

Set DataAdapter Object Properties SelectCommand

SqlDataAdapter da = new SqlDataAdapter (STRSQLL, sqlconstr);d a.selectcommand.commandtimeout = 180;

Run to resolve the timeout problem. This setting has an immediate effect on DataAdapter returning multiple record query time-outs (repeater binding data for multiple times). The set time is 180 seconds and can be changed as needed.

Settings for timeout in ASP.

In the Web. config <system.web> node, add the following code:

<system.web> 
MSDN explained:


Executiontimeout: Represents the maximum time limit allowed to execute a request in seconds maxRequestLength: Indicates the maximum file upload size supported by ASP. This restriction can be used to prevent denial of service attacks that result from the user passing a large number of files to the server. The specified size is in kilobytes. The default value is 4096 KB (4 MB).

WebService settings for request time-out:

Expands the time-out limit for the proxy class by default of 90 seconds, that is, specifying a time-out before calling the method.
Yourwebservice Yws = new Yourwebservice (); Yws. Timeout = 1200000; 20 minutes, Unit is milliseconds
If the Timeout property is set to Timeout.infinite, it indicates that the request has no time-out. Even if the XML Web Services client can set the Timeout property to no time-out, the Web server can still make the request time-out on the server side.

the request time-out setting in IIS.

iis-Web Site-Attribute connection timeout 1200 seconds

Timeout timeout time has expired. The timeout period has expired or the server is not responding before the operation completes

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.