Hi @Gani_tpt,
The MaxPoolSize property sets the maximum number of connections allowed in the connection pool for this particular connection string. Its default value is 100.
When multiple users (more than 300 users) access, the default value will be exceeded.
You can set the MaxPoolSize property to adjust the number of connections, but other than that it's best to check your own code.
In most cases connection pooling problems are related to connection leaks. Your application probably doesn't close its database connections correctly and consistently.
What you must do every time your app does db work is to make sure that SqlDataReaders, SqlCommand, SqlConnection objects are closed and disposed of as soon as possible.
The correct way would be this:
var connection = new SqlConnection(ConnectionString);
try
{
connection.Open();
someCall (connection);
}
catch
{
// ...
}
finally
{
connection.Close();
}
or
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
someCall(connection);
}
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread