Tôi có một ứng dụng trong asp.net 3.5 và cơ sở dữ liệu là SQL Server 2005.thế nào để Solve Max Connection Pool Lỗi
"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."
Một thời gian lỗi này xảy ra như thế nào để giải quyết lỗi này ..
tôi thử SqlConnection.ClearAllPools();
nhưng điều này cũng không hoạt động.
SqlCommand cmdToExecute = new SqlCommand();
cmdToExecute.CommandText = "dbo.[sp_user_listing]";
cmdToExecute.CommandType = CommandType.StoredProcedure;
DataTable toReturn = new DataTable("courier_user_listing");
SqlDataAdapter adapter = new SqlDataAdapter(cmdToExecute);
// Use base class' connection object
cmdToExecute.Connection = sqMainConnection;
try
{
cmdToExecute.Parameters.Add(new SqlParameter("@suser_name", SqlDbType.VarChar, 250, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, _user_name));
if (blnMainConnectionIsCreatedLocal)
{
// Open connection.
sqMainConnection.Open();
}
else
{
if (CPMainConnectionProvider.IsTransactionPending)
{
cmdToExecute.Transaction = CPMainConnectionProvider.CurrentTransaction;
}
}
// Execute query.
adapter.Fill(toReturn);
i32ErrorCode = (Int32)cmdToExecute.Parameters["@iErrorCode"].Value;
if (i32ErrorCode != (int)LLBLError.AllOk)
{
// Throw error.
throw new Exception("Stored Procedure 'sp_courier_user_SelectAll' reported the ErrorCode: " + i32ErrorCode);
}
return toReturn;
}
catch (Exception ex)
{
// some error occured. Bubble it to caller and encapsulate Exception object
throw new Exception("Courier_user::SelectAll::Error occured.", ex);
}
finally
{
if (blnMainConnectionIsCreatedLocal)
{
// Close connection.
sqMainConnection.Close();
}
cmdToExecute.Dispose();
adapter.Dispose();
}
"Hết thời gian chờ". - Tôi có thể nghĩ ra nhiều lý do tại sao một thời gian chờ sẽ xảy ra trước khi giả sử bạn đã đạt được kết nối tối đa .... –
Hiển thị mã của chúng tôi –
@MitchWheat - Đúng, chỉ có thông báo lỗi là rõ ràng về các kết nối tối đa bị trúng. – Oded