The timeout period elapsed prior to obtaining a connection from the pool

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."

Description
When you open an SQL Connection object, it always takes from an available pool of connections. When you close the connection, asp.net will release the connection to the pool of connections so that next connection object can use it.

If you open connections with out closing them and when the pool reaches maximum connections, it will throw the specified error. Make sure you are not opening connection inside loop, if you open connection make sure you are closing it immediately after you execute the query.

Solution:
You can try the following things

1. Always close your connection in the finally block

2. Increase pool size like in your connection string
string connectionString = "Data Source=localhost; Initial Catalog=Northwind;" +
"Integrated Security=SSPI; Min Pool Size=10; Max Pool Size=100";

3. Don't use pooling at all

string connectionString = "Data Source=localhost; Initial Catalog=Northwind;" +
"Integrated Security=SSPI; Pooling=false;";

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."

Discription: 
When you open an SQL Connection object, it always takes from an available pool of connections. When you close the connection, asp.net will release the connection to the pool of connections so that next connection object can use it.

If you open connections with out closing them and when the pool reaches maximum connections, it will throw the specified error. Make sure you are not opening connection inside loop, if you open connection make sure you are closing it immedietly after you execute the query.

Solution:
You can try the following things

1. Always close your connection in the finally block

2. Increase pool size like in your connection string
string connectionString = "Data Source=localhost; Initial Catalog=Northwind;" +
"Integrated Security=SSPI; Min Pool Size=10; Max Pool Size=100";

3. Don't use pooling at all
string connectionString = "Data Source=localhost; Initial Catalog=Northwind;" +
"Integrated Security=SSPI; Pooling=false;";

  •  
  • web hosting free, dedicated server hosting unlimited bandwidth, linux vps, web hosting for students, dedicated server vs vps, dedicated server hosting USA, dedicated server hosting asp.net, dedicated server hosting atlanta, dedicated server gaming, web hosting vs wordpress hosting, vps hosting free, web hosting with free ssl, dedicated server vs shared hosting, web hosting vs cloud hosting, dedicated server hosting comparison, wordpress hosting, web hosting wiki, dedicated servers vs p2p, dedicated server hosting benefits, dedicated server ark, dedicated server cloud hosting, dedicated server minecraft, dedicated server hosting advantages, web hosting definition, dedicated servers meaning, web hosting google, dedicated server hosting cheapest
  • 787451 Users Found This Useful
Was this answer helpful?

Related Articles

The query has been canceled because the estimated cost of this query () exceeds the configured threshold.

Error:The query has been canceled because the estimated cost of this query () exceeds the...

Powered by WHMCompleteSolution