此方法会导致错误文件充满此错误:
Connection Pool has reached the maximum number of connections
public static int IsValidPortalUser(string p_u, string p_p) {
int item = 0;
using (IfxConnection ifxConnection = new IfxConnection(DB_Connection.connectionString))
{
IfxCommand ifxCommand = new IfxCommand();
string str = DB_Connection.My_Decryption_2(p_p);
try
{
if (ifxConnection.State == 0)
{
ifxConnection.Open();
}
DB_Connection.DBCmd = new IfxCommand();
DB_Connection.DBCmd.Connection = ifxConnection;
DB_Connection.DBCmd.CommandText = "SELECT nvl(emp_num,0) FROM htoemp WHERE username = ? AND DECRYPT_CHAR(password, '78dfdf') = ? ";
DB_Connection.DBCmd.Parameters.Add("user_name", p_u);
DB_Connection.DBCmd.Parameters.Add("password", str);
IfxDataReader ifxDataReaders = ifxCommand.ExecuteReader();
using (ifxDataReaders)
{
if (ifxDataReaders.Read())
{
item = (int)ifxDataReaders[0];
}
ifxDataReaders.Close();
}
}
catch (ApplicationException applicationException)
{
}
ifxConnection.Close();
}
return item;
}
Error Message:Connection Pool has reached the maximum number of connections. Stack Trace : at IBM.Data.Informix.IfxConnectionPool.ReportOpenTimeOut()
at IBM.Data.Informix.IfxConnectionPool.Open(IfxConnection connection)
at IBM.Data.Informix.IfxConnPoolManager.Open(IfxConnection connection)
at IBM.Data.Informix.IfxConnection.Open()
at DB_Connection_s.DB_Connection.IsValidPortalUser(String p_u, String p_p)
at LoginSystem.LoginPage_ar.ValidateUser(String UserName, String Password) in H:\LoginSystem\LoginSystem\LoginPage_ar.aspx.cs:line 20
at LoginSystem.LoginPage_ar.ibtn_login_Click(Object sender, ImageClickEventArgs e) in H:\LoginSystem\LoginSystem\LoginPage_ar.aspx.cs:line 33
at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
现在我设置了Max Pool Size=400
而不是Max Pool Size=200
直到现在还没有这种类型的错误。但我想知道为什么这种方法会导致这个问题。