Last post Feb 05, 2013 07:47 PM by Decker Dong - MSFT
Feb 01, 2013 11:26 AM|mat.mdig|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?
Feb 02, 2013 08:25 PM|Decker Dong - MSFT|LINK
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(……))
Feb 05, 2013 10:39 AM|mat.mdig|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?
Feb 05, 2013 07:47 PM|Decker Dong - MSFT|LINK
My question is, once the number of connections has exceeded the max size, how do I go about resetting it?
Have you set the max pool for connection?
What's your connection string?