0

PS : I know there is a lot of similar question but I can't find my solution.

Since I've changed my database server, I have a lots of that error (5000-8000 per day VS 20-50 per day before the server change) :

Exception type: InvalidOperationException Exception 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.

This is what I've done :

  • Server > properties > connections > maximal number of connections = 0 (unlimited)

  • Server > properties > connections > allow remote connections

  • Server > properties > connections > timeout = 1200sec (I had 600 but I've increased it)

  • All the db connections opened from my code are in "using" statement or well-closed (in a "finally" statement).

  • On the web server, nothing has changed, but I've tried to increase the MaxPoolSize to 500 in the connection string. No improvement after that modification...

  • still in connection string, I've tried to add TransparentNetworkIPResolution = False but no improvement neither

Note : I am using a dedicated windows user in my connection pool (window authentication) and I don't have those errors with my others applications, on the same web server, communicating with the same sql-server.

I assume there is a configuration relative to SQL server I don't know ! Could you help me ?

ordiminnie
  • 97
  • 10
  • 1
    You mention "using" statements on your connections. Are you also invoking `SqlCommand.ExecuteReader()` in your code? The `SqlDataReader` that's returned is `IDisposable` and also needs to be `Close()`d or disposed of correctly so that it releases its lock on the connection. – AlwaysLearning Nov 09 '21 at 11:21
  • 1
    The client connection pool errors may be a symptom that queries are running more slowly on the new server. Rather than focus on connections, I suggest query/index tuning for starters. If the SQL version was changed, there are additional factors to consider. – Dan Guzman Nov 09 '21 at 11:28
  • @DanGuzman Thanks for the suggest. I've rebuild all indexes. I am gonna check the errors log the next few hours. About queries tuning, it should be not necessary since they were fine on the previous server. – ordiminnie Nov 09 '21 at 14:36
  • Have you tried the solutions in this link? [https://stackoverflow.com/questions/670774/how-can-i-solve-a-connection-pool-problem-between-asp-net-and-sql-server](https://stackoverflow.com/questions/670774/how-can-i-solve-a-connection-pool-problem-between-asp-net-and-sql-server). – samwu Nov 10 '21 at 02:51

0 Answers0