读书人

sos!菜鸟有关问题

发布时间: 2011-12-22 23:36:25 作者: rapoo

sos!菜鸟问题
Server Error in '/ ' Application.
--------------------------------------------

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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: 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.

Source Error:


Line 27:
Line 28: SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings[ "Str_sql "]);
Line 29: con.Open();
Line 30: SqlDataAdapter sda = new SqlDataAdapter( "select * from business where business_id= ' " + Business_id + " ' ", con);
Line 31:


Source File: e:\wwwroot\wwwroot\invite\sanji.aspx.cs Line: 29

Stack Trace:


[InvalidOperationException: 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.]
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +1184425
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
invite_sanji.Page_Load(Object sender, EventArgs e) in e:\wwwroot\wwwroot\invite\sanji.aspx.cs:29
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47


System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061




--------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

[解决办法]
报的错是连接超时,最好检查以下你Web.Config中的连接字符串是否正确
[解决办法]
同时打开的连接数太多,超出连接池的限制了。
数据库连接要在需要的时候打开,用完马上关闭。
[解决办法]
看看数据库连接是否及时关闭掉了
[解决办法]
数据库连的上么
[解决办法]
用sql事件探查器跟踪看看
[解决办法]
人为检查的关闭不算,除非你非常nb,最常见的try会跳过连接关闭语句,最好在适当的地方加上Response.Write(conn.State);
[解决办法]
看哪里有conn.open 就在cmd.exec后面加conn.close()
sqlserver 如果conn超过6-10没有关闭,那就运行很慢了
[解决办法]
超出连接池的限制了
[解决办法]
con.Open();
con.Close();不成对出现的问题吧 肯定在该页面有在这数据连结前没有close
[解决办法]
我找了所有的程序我 打开的数据库 都关闭了。不会存在这个问题的。
-------------------------------
这句话说的太满了。呵呵。
你是这样写的吧
con.Open();
//处理
con.Close();
假如在//处理 中引发个异常什么的,程序中断,那么后面就没关闭。你的问题肯定是 连接没有关闭。某些地方改下写法吧。
[解决办法]
你的基类怎么写的啊.
用完就给关了.要是再有就是不是关没关的问题了.

[解决办法]
protected int ExecuteSql(string strCom)
{
OleDbConnection conn = new OleDbConnection(GetStrConnection());
OleDbCommand comm = new OleDbCommand(strCom,conn);

try
{
conn.Open();
int res = comm.ExecuteNonQuery();
return res;
}
catch(System.Data.SqlClient.SqlException ex)
{
throw new Exception(ex.Message);
}
finally
{
comm.Dispose();
conn.Close();
}

读书人网 >asp.net

热点推荐