我有一个exe,它给出了以下错误。
超时已过期。在获得a之前经过了超时时间 从游泳池连接。这可能是因为所有人都集中了 正在使用连接并达到最大池大小。
我使用使用语句来创建连接对象并关闭 在finally块中的连接。
在exe连接字符串的web.config中,最大app_pool大小值为200。
我还使用sp_who2命令检查了连接,此命令显示25个连接。
private Dictionary<string, SomeObject> SomeMethod(int orderedXmlId, string clientLogFilePath, ref bool errorGettingRMData)
{
Dictionary<string, SomeObject> someDictionary = new Dictionary<string, SomeObject>();
//Create connection object
using (SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["MasterDB"]))
{
SqlCommand command = null;
try
{
//open the connection
connection.Open();
command = new SqlCommand("someSP", connection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@someParameter", someParameter);
command.CommandTimeout = _commandTimeOut;
using (SqlDataReader someVariable = command.ExecuteReader(CommandBehavior.CloseConnection))
{
if (someVariable != null && someVariable.HasRows)
{
int intId = someVariable.GetOrdinal("intId");
int imageUrl = someVariable.GetOrdinal("imageUrl");
int contentLength = someVariable.GetOrdinal("contentLength");
int path = someVariable.GetOrdinal("path");
int parentId = someVariable.GetOrdinal("parentId");
int propertyId = someVariable.GetOrdinal("propertyId");
while (someVariable.Read())
{
using (SomeObject someUploadObject = new SomeObject())
{
// Avoid this Exception: "An item with the same key has already been added".
if (!someDictionary.ContainsKey(someVariable.GetString(intImageUrlOrdinal)))
{
someUploadObject.OrderedXmlId =
someVariable.GetInt32(intOrderedXMLIdOrdinal);
someUploadObject.ImageUrl = someVariable.GetString(intImageUrlOrdinal);
someUploadObject.ContentLength =
someVariable.GetInt64(intContentLengthOrdinal);
someUploadObject.SaveAsPath = someVariable.GetString(intSaveAsPathOrdinal);
someUploadObject.ParentOrderedXmlId =
someVariable.GetInt32(intParentOrderedXmlIdOrdinal);
someUploadObject.PropertyId = someVariable.GetString(intPropertyIdOrdinal);
//Add to Dictionary
someDictionary.Add(someUploadObject.ImageUrl, someUploadObject);
}
else
{
if (detailedLog)
{
AddToLog("SomeMethod: Image {0}, for id:{1} is already present in someDictionary",
new object[] { someVariable.GetString(imageUrlOrdinal), lId }, 80,
false, true, clientLogFilePath);
}
}
}
}
someVariable.Close();
}
//No records are found i.e. Datareader is empty
else
{
//Do nothing
}
}
}
catch (Exception ex)
{
errorGettingData = true;
Logger.Write2Log("SomeMethod: Error in retrieving uploaded images for id:" + Id + "-" + ex.Message, true, 40, true, logFilePath);
SendMail(MailOption.exception, ex, logFilePath);
}
finally
{
command = null;
if (connection != null)
{
connection.Close();
}
}
//Return list of Dictionary
return someDictionary;
}
} //SomeMethod
知道这里可能出了什么问题吗?
答案 0 :(得分:2)
嗯,这个错误是自我描述的。从通常的嫌疑人开始: