从数据库提取数据时::超时时间已到。在从池中获取连接之前超时时间已过…………

超时时间已到。在从池中获取连接之前超时时间已过。出现这种情况可能是因为所有池连接都已被使用并已达到最大池大小。

————————————————————————————————————

行 25: {
行 26: Sql = "Select id,name from class where class = 'com'";
行 27: SqlDataReader dr = MySql.Read(Sql); //MySql.Read()为自编的函数
行 28:
行 29: while(dr.Read())
……………………

————————————————————————————————————

InvalidOperationException: 超时时间已到。在从池中获取连接之前超时时间已过。出现这种情况可能是因为所有池连接都已被使用并已达到最大池大小。]
System.Data.SqlClient.SqlConnection.Open() +761
DB.SQL.Read(String Sql_Read) +72
ASP.Cread_xml_aspx.Page_Load(Object sender, EventArgs e) in D:\www\xysj\adsl\cread_xml.aspx:27
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724

————————————————————————————————————

??????怎么办???????????????
---------------------------------------------------------------

SqlConnection可设定connection pool的maxpoolsize和minpoolsize

例如:str_Conn="data source=ntserver;initial catalog=gc_web;persist security info=true;"+
"Enlist=true;Pooling=true;Max Pool Size=300;Min Pool Size=0;Connection Lifetime=300;user id=sa;packet size=4096";

还可以设定SqlCommand.CommandTimeOut 或者Sqlconnection.GeneralTimeOut

Published At
Categories with Web编程
Tagged with
comments powered by Disqus