Today I got an exception when I run my application from the below code
dbContext.ManageTasks.Where(x => x.IsDeleted == false).ToList();
Error is
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.
I got a solution from this discussion : How can I solve a connection pool problem between ASP.NET and SQL Server?
Solution is : if I close current connection string object, then this error will be gone.
SqlConnection myConnection = new SqlConnection(ConnectionString);
myConnection.Open();
// some code
myConnection.Close();
The above code for ADO.NET, not Entity Framework.
How can I close the connection string object in Entity Framework?