高分请教。net访问不稳定
在一个。net开发的系统上,最近因为以下两件事导致访问不稳定,特别是访问量大的时候。
若还需要什么资料,请指示我再贴上。放假前结贴。
第一、
在服务器上的事件查看器里,看到这种红色错误:
一般发生的当天会密集发生十次左右。
Failed to execute request because the App-Domain could not be created. Error: 0x8007000e 存储空间不足,无法完成此操作。
有关更多信息,请参阅在 http://go.microsoft.com/fwlink/events.asp 的帮助和支持中心。
请教如何跟踪到是哪里出了问题?或者有解决办法最好 。
第二、
超时问题,寻找网络,大部分说连接问题。
Exception information:
Exception type: InvalidOperationException
Exception message: 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.
于是我把我的网站的所有数据操作方式写出:
请高手指教有何漏洞:
1.
try
{
myConnection.Open();
object result = myCommand.ExecuteScalar();
myConnection.Close();
if (result != null)
return (string)result;
else
return "";
}
catch
{
myConnection.Close();
return "";
}
2。
myConnection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();
3.
myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
return result;
4.
try
{
myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
if (result.HasRows)
return true;
else
return false;
}
catch
{
return false;
}