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.
OK, I wrote bad code, and didn't close it properly. I've fixed that, but I still can't connect to the database. My guess is the connections are still open. How do I close the connections that were created? I can't do anything on any of the ASP.NET pages
because it gives me this error when I try to open the page.
You can try to use the "using……" block to enclose all of your other codes related to SqlConnection, and when your codes are executed completely, they will release the memory taken by themselves, something like this following:
using(SqlConnection con = new SqlConnection(……))
{
………………
}
I've already fixed the code to properly close the connection. My question is, once the number of connections has exceeded the max size, how do I go about resetting it? I ended up rebooting the server, but surely there has to be an easier way?
mat.mdig
Member
31 Points
29 Posts
The timeout period elapsed prior to obtaining a connection from the pool.
Feb 01, 2013 03:26 PM|LINK
I'm getting the following error message:
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.
OK, I wrote bad code, and didn't close it properly. I've fixed that, but I still can't connect to the database. My guess is the connections are still open. How do I close the connections that were created? I can't do anything on any of the ASP.NET pages because it gives me this error when I try to open the page.
How do I reset all the connections to the pool?
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: The timeout period elapsed prior to obtaining a connection from the pool.
Feb 03, 2013 12:25 AM|LINK
Hi,
You can try to use the "using……" block to enclose all of your other codes related to SqlConnection, and when your codes are executed completely, they will release the memory taken by themselves, something like this following:
using(SqlConnection con = new SqlConnection(……)) { ……………… }mat.mdig
Member
31 Points
29 Posts
Re: The timeout period elapsed prior to obtaining a connection from the pool.
Feb 05, 2013 02:39 PM|LINK
I've already fixed the code to properly close the connection. My question is, once the number of connections has exceeded the max size, how do I go about resetting it? I ended up rebooting the server, but surely there has to be an easier way?
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: The timeout period elapsed prior to obtaining a connection from the pool.
Feb 05, 2013 11:47 PM|LINK
Have you set the max pool for connection?
What's your connection string?