Timeout expired - connections
A开发者_高级运维ny idea what condition this might happen?
I have properly opened & closed connections in my code, can this be due to any server issue?
What is the best solution for this? How/where do i check max connections?
System.ApplicationException: MySqlException raised in OpenConnection, error connecting: 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. ---> MySql.Data.MySqlClient.MySqlException: error connecting: 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.
From the exception message it seems that you are experiencing a timeout while trying to obtain a connection. As suggested by the message, you can try and increase the maximum pool size. You can do this by specifying a new value in the connection string. The keyword for this is - 'max pool size'. Just add the following key-value pair to your connection string 'max pool size = new value'.
You can also use the 'MySqlConnectionStringBuilder' class and set the 'MaximumPoolSize' property.
The default max pool size is 100 and if you are indeed running out of connections then it would be advisable to analyse your connection handling first instead of increasing the max pool size.
精彩评论