ASP.net getting "timeout period elapsed prior to obtaining a connection"
"
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."This exception often happens when an Asp.Net application is not properly closing the connecting after using them.
To find out in SQL Server how many connections are open per application run the following query:
SELECT Program_name, count(*)
FROM master..sysprocesses
GROUP BY Program_name
ORDER BY count(*) descIt's best practice to set the application name in the ConnectionString so it's easier to diagnose which application has open connection. Here's how to set it in the connectionStrings element of the web.config
<add name="connectionStringName" connectionstring="Data Source=localhost;Initial Catalog=databaseName;User ID=dbLogin; Password=dbPassword;Application Name=applicationName;">
</add>