Hi
Can any one help to get rid of this error
"Time Out expired.The time out elapsed prior to obtaining a connection from the pool .This have occurred because all pooled connections were in use and max pool size was reached"
Thank You
Hi
Can any one help to get rid of this error
"Time Out expired.The time out elapsed prior to obtaining a connection from the pool .This have occurred because all pooled connections were in use and max pool size was reached"
Thank You
This generally occurs when trying to connect to a database after exhausting all available connections. This article on Tuning Up ADO.NET Connection Pooling in ASP.NET Applications should explain how to fix the issue you are having. That said things to try: close all SqlConnections, dispose of all Sqldatasources, and increase the max pool size.
did you remember to close each of the database connections after you used them?
In your connection string, make sure you set pooling=false
<connectionStrings>
<clear/>
<add
name="YourConnectionString"
connectionString="Server=localhost;Database=your_db;Uid=username; _
Pwd=password;pooling=false;" <---------------POOLING = FALSE
providerName="yourprovider"/>
</connectionStrings>
Make sure you're implementing using blocks for every object that you create that implements IDisposable:
using (var connection = new SqlConnection(connectionString)) {
using (var command = new SqlCommand(query, connection)) {
using (var reader = command.ExecuteReader()) {
while (reader.Read()) {
// do something with row
}
}
}
}
Otherwise, you will leak resources (including connections) when an exception occurs.
BTW, in VB, that's
Using connection As SqlConnection = New SqlConnection(connectionString))
...
End Using