Exception information: Exception type: MySqlException
Exception message: 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.
The above is the error that I am getting in the event viewer. This exception only seems to occur on our development server. It is an in-house warehouse management and private company webshop. We have less than a 100 users on it at a given time and this is what I understand:
Things that I have done to try to solve the issue:
This still seems to cause the same issues and I am currently at my wits end. To damage control this issue I am killing users with threads older than an hour or two.I have monitored that during these crashes there are only around 108 connections at maximum. One particular time it stopped accepting connections when there were 40 IDLE threads.
Below is the code used to make transactions.
/// <summary>
/// Begin a database transaction.
/// </summary>
/// <returns>The database connection.</returns>
public DbTransaction BeginTransaction()
{
if (_DbConnection.State != ConnectionState.Open)
{
_DbConnection.Open();
}
return _DbConnection.BeginTransaction();
}
/// <summary>
/// Commit a database transaction.
/// </summary>
/// <param name="transaction">The database connection.</param>
public void CommitTransaction(DbTransaction transaction)
{
if (transaction != null)
{
transaction.Commit();
transaction.Dispose();
}
if (_DbConnection != null)
{
_DbConnection.Close();
}
}
/// <summary>
/// Rollback a database transaction.
/// </summary>
/// <param name="transaction">The database transaction.</param>
public void RollbackTransaction(DbTransaction transaction)
{
if (transaction != null)
{
transaction.Rollback();
}
}
修改连接字符串后,请尝试实际保存它们。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.