We are trying to diagnose a problem that occurred in our production environment last week. In short, the database connection pool seemed to be filled with active connections from our ASP.NET 3.5 application, which would not be cleared even after restarting the application pool and IIS.
The senior database administrator said that since network connections occur at the operating system level, the utilization of the application and IIS did not interfere with the actual network connections, so SQL Server left the database connections to continue working, and our application is still unable to access the database.
In searching for ways to force the pool of connections to the database reset, I found the static method SqlConnection.ClearAllPools() with documentation explaining what it does, but almost nothing explains when to call it. It seems to call it at the beginning of Application_Start , and the end of Application_End in my global.asax.cs file is a good security measure to protect the application from poisoned connection pools, although this, of course, will lead to a performance hit on / off.
Is this what I described as good practice? Is there a better one? The goal is to allow a simple restart of the application to reset the pool of connected applications without rebooting the OS or SQL Server service, which will affect many other applications.
Any guidance is greatly appreciated.
source share