网站运行过程中出现如下错误

coutisy 2010-10-27 04:34:15
我用的是SqlHelper,网站采用三层开发模式,DAL中我都对连接进行了释放.因为开始写程序的时候用比较多的sqldatareader比较多,所以我都把连接释放掉。我没有设置连接池.我想这个错误也不会经常出现.但它还是出现了。请路过的朋友,帮我分析分析...多谢了

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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

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) +4863722
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
BindData.BindCategoryTreeView(TreeView treeView, Boolean isExpanded, String sSelectedData, String cmdText) +141
product.treeVeiwBinData() +73
product.Page_Load(Object sender, EventArgs e) +89
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618


...全文
116 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyq11 2010-10-27
  • 打赏
  • 举报
回复
超时。在查询分析执行语句
优化SQL
minwen9704135 2010-10-27
  • 打赏
  • 举报
回复
数据库连接失败
第一;检查数据库是否正常工作
第二;查看数据库中已经使用了多少个连接
君望永远 2010-10-27
  • 打赏
  • 举报
回复
虽然爆
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.


看下程序练的上数据库么?DB挂啦?一般这个原因
边城的刀声 2010-10-27
  • 打赏
  • 举报
回复
我们项目中的连接串超时时间是3367秒,然后对数据库的很多地方都没有关闭,但从来不会出现你这种错误
怎么来这一出 2010-10-27
  • 打赏
  • 举报
回复
貌似是连接超时!具体问题我也没遇到过,等待高手!
边城的刀声 2010-10-27
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 coutisy 的回复:]

引用 1 楼 hookyzlr 的回复:
贴出你的数据操作方法,看看你是怎么释放的。

就是用连接的dispose()方法啊!
[/Quote]
Close()或者Dispose()都可以,最好用using(SqlConnection conn = new SqlConnection("")){}这样来关闭
仙儿 2010-10-27
  • 打赏
  • 举报
回复
链接超时?
yang318 2010-10-27
  • 打赏
  • 举报
回复
上面的真解
边城的刀声 2010-10-27
  • 打赏
  • 举报
回复
或者是你在连接串中把timeout设置的长一些,让它等会儿
coutisy 2010-10-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 hookyzlr 的回复:]
贴出你的数据操作方法,看看你是怎么释放的。
[/Quote]
就是用连接的dispose()方法啊!
边城的刀声 2010-10-27
  • 打赏
  • 举报
回复
池中的连接不够了,大概是有的地方在使用完connection后,没有及时Close();
hookyzlr 2010-10-27
  • 打赏
  • 举报
回复
贴出你的数据操作方法,看看你是怎么释放的。

62,272

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧