Many database problems are caused by a "connection leak" where your application does not close its database connections consistently. Database connections remain open until the garbage collection closes them which may takes hours. Eventually your application may no longer be able to connection to your database. You may receive an error such as the follow:
Exception: System.InvalidOperationException Message: 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. Source: System.Data at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open()
When you're finished with your database connection you must ensure that it is closed such as shown in the following code:
SqlConnection conn = new SqlConnection(myConnectionString);
In addition to ensuring your connections objects are closed, you may set the minimum and maximum pool sizes by adding the following to your connection string: "min pool size=1max pool size=50". As a last resort you may disable connection pooling until you've had time to fix your application, however, this may cause performance issues with your application. Connection pooling may be disabled by adding the following to your connection string: "pooling=false".