Here are some scripts to help debug an error like
System.InvalidOperationException: 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.
- Script to check SQL Server connection pooling
- SQL Server Connection Pooling Myths
- ADO.NET Connection Pooling Explained
Sample SQL to see connections:
SELECT spid, uid=rtrim(loginame), Program_name=rtrim(Program_name), dbname=db_name(dbid), status=rtrim(status) FROM master.dbo.sysprocesses WHERE db_name(dbid) = 'DatabaseName'