ERROR TIMOUT EXPIRED .....HOW TO RESOLVE THE PROBLEM

  • I GOT ERROR LIKE BELOW..............................

    Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

    Source Error:

    Line 624: //string value1 = ddlCatogiries.SelectedItem.Text;

    Line 625: SqlConnection con = new SqlConnection("Data Source=SRR-PC;Initial Catalog=CRPmerged;Persist Security Info=True;User ID=sa;Password=123");

    Line 626: con.Open();

    Line 627: SqlCommand cmd = new SqlCommand("select ReferMiddleName,ReferMemberId,SurName,MiddleName,FatherName,Mobile,DNO,Street,Colony,Location,Qualification from Registration4 where VoterIdNo ='" + TextBox1.Text + "' ", con);

    Line 628: SqlDataAdapter da = new SqlDataAdapter(cmd);

    Source File: c:\EMP1\verification.aspx.cs Line: 626

    Stack Trace:

    [InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.]

    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4871162

    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117

    System.Data.SqlClient.SqlConnection.Open() +122

    _Registration.BindGridview2() in c:\EMP1\demoverification.aspx.cs:626

    _Registration.TextBox1_TextChanged(Object sender, EventArgs e) in c:\EMP1\demoverification.aspx.cs:654

    System.Web.UI.WebControls.TextBox.OnTextChanged(EventArgs e) +8763286

    System.Web.UI.WebControls.TextBox.RaisePostDataChangedEvent() +55

    System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +10

    System.Web.UI.Page.RaiseChangedEvents() +165

    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1485

  • did you tried to connect to the server from SSMS with the same credentials you have in connection string?

  • 1. Make sure you are closing the connection after each request made to server. You can check the open connections using below T-SQL.

    SELECT

    DB_NAME(dbid) as DBName, status,

    COUNT(dbid) as NumberOfConnections,

    loginame as LoginName

    FROM

    sys.sysprocesses

    WHERE

    dbid > 0

    GROUP BY

    dbid, loginame, status

    2. Increase the time out of connection object, default is 30 seconds.

  • Sounds like your code is opening connections and then not closing them. I would focus there.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply