Hi...
I am getting an error -
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.
---
Please help in solving this...
Is there a particular way or any statement for such type of errors ??
Loading
Jignesh TrivediPosted Feb 22, 2015, 11:35 PM
Hi,
Please refer below link i tmight help you.
http://forums.asp.net/t/1968696.aspx?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+
https://msdn.microsoft.com/en-us/library/aa175863(SQL.80).aspx
Manish Kumar ChoudharyPosted Feb 22, 2015, 10:58 PM
Riddhi ValechaPosted Feb 22, 2015, 5:09 AM
All my Database functions are in class file (FunctionClass.cs file).
Can I write this -
SQLConnection con = new SQLConnection();
SQLConnction.ClearPool(con);
con.ConnectionString = ""; //Connection string
con.state = ConnectionState.Open();
------------------------------
Or I need to change ??
Abhishek YadavPosted Feb 21, 2015, 3:08 PM
Basically this error occurs whenever connection pool limit exceeds.This can be resolved by clearing connection pool.
Use SqlConnection.ClearAllpools(); method in Page_Unload event, this will close all the connections or else close all the connections explicitly.
SqlConnection.ClearAllpools() method empties the connection pools. If you don't want to write this method in Page_Unload event, then create 1 button_Click event as shown below.
private void btnClear_Click(object sender, EventArgs e) { SqlConnection.ClearAllPools();//myLabel.Text = "Pool has been cleared.";
}