Question : SqlClient Data Provider too many processes per user

ASP.NET (2.0 and 3.5)
VS2008 (and VS2005)
SQL Server 2000 Standard
IIS 6

When running an aspx website connected to a SQL database (and after 3 page refreshes) I am getting this error:
"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 check the sysprocesses using this query:
SELECT     program_name, COUNT(*) AS Expr1
FROM         master.dbo.sysprocesses
GROUP BY program_name
ORDER BY COUNT(*) DESC            

this process ".Net SqlClient Data Provider" comes up as running more than 100 processes after refreshing the aspx page that makes the database connection and I am the only user on this system.

to prevent SQL Server timeout I add this to the connect string: "Min Pool Size=5;Max Pool Size=500;Connect Timeout=2;" and I can run without timing out.

Now the kicker: the same website on a different server runs only 1 ".Net SqlClient Data Provider" no matter how many page refreshes (which tells me the problem is not in the asp code but on some server configuration which on first checkup look the same).

Where do I need to look for this problem?

Answer : SqlClient Data Provider too many processes per user

You can hook the handler anonymously for several of your 30 connections . Just change the text in methodName so you can know which connection wrote which entry to the log.
1:
2:
3:
4:
5:
6:
7:
8:
9:
      conn.StateChange += new StateChangeEventHandler(delegate(object sender, StateChangeEventArgs e) {
        string methodName = "Conn1";
        string logFile = @"c:\log.txt";
 
        System.IO.StreamWriter writer = new System.IO.StreamWriter(
          new System.IO.FileStream(logFile, System.IO.FileMode.Append, System.IO.FileAccess.ReadWrite));
        writer.WriteLine("{0}\t{1:HH:mm:ss.fff}\t{2}->{3}", methodName, DateTime.Now, e.OriginalState, e.CurrentState);
        writer.Close();
      });
Open in New Window Select All
Random Solutions  
 
programming4us programming4us