超時時間已到。在操作完成之前超時時間已過或服務器未響應


某日,業務系統達到了15萬數據,客戶反映隔1個小時左右就出現無法連接到數據庫,需要重新啟動MS SQL Server才恢復正常,經錯誤跟蹤發現以下錯誤:

 

 

“/XXX”應用程序中的服務器錯誤。

超時時間已到。在操作完成之前超時時間已過或服務器未響應。

說明: 執行當前 Web 請求期間,出現未處理的異常。請檢查堆棧跟蹤信息,以了解有關該錯誤以及代碼中導致錯誤的出處的詳細信息。

異常詳細信息: System.Data.SqlClient.SqlException: 超時時間已到。在操作完成之前超時時間已過或服務器未響應。

源錯誤:

行 71:  行 72:  行 73:            DataSet ds = db.ExecuteDataSet(dbCommand); 行 74:            if (int.TryParse(db.GetParameterValue(dbCommand, "TotalPage").ToString(), out result)) 行 75:                TotalPage = (int)db.GetParameterValue(dbCommand, "TotalPage");

源文件: XXX.DAL\Pager\DataPager.cs    行: 73

堆棧跟蹤:

[SqlException (0x80131904): 超時時間已到。在操作完成之前超時時間已過或服務器未響應。]    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194    System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392    System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33    System.Data.SqlClient.SqlDataReader.get_MetaData() +83    System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297    System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32    System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141    System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12    System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10    System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +94    Microsoft.Practices.EnterpriseLibrary.Data.Database.DoLoadDataSet(DbCommand command, DataSet dataSet, String[] tableNames) +865    Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DbCommand command, DataSet dataSet, String[] tableNames) +110    Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DbCommand command, DataSet dataSet, String tableName) +103    Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteDataSet(DbCommand command) +111    .DAL.Pager.DataPager.GetPager2005(String TableName, String Fields, String OrderField, String sqlWhere, Int32 PageSize, Int32 PageIndex, Int32& TotalPage) in E:\Works\\Source\\.DAL\Pager\DataPager.cs:73    .BLL.Pager.DataPager.GetPager2005(String TableName, String Fields, String OrderField, String sqlWhere, Int32 PageSize, Int32 PageIndex, Int32& TotalPage) in E:\Works\\Source\\.BLL\Pager\DataPager.cs:44    Retiree_RetireeInfoSearchResult.BindGridView(String strWhere, Boolean isBind) in e:\Works\\Source\\.WebUI\Retiree\RetireeInfoSearchResult.aspx.cs:254    Retiree_RetireeInfoSearchResult.aspnetPager_PageChanged(Object src, EventArgs e) in e:\Works\\Source\\.WebUI\Retiree\RetireeInfoSearchResult.aspx.cs:272    Wuqi.Webdiyer.AspNetPager.OnPageChanged(EventArgs e) +97    Wuqi.Webdiyer.AspNetPager.OnPageChanging(PageChangingEventArgs e) +191    Wuqi.Webdiyer.AspNetPager.RaisePostBackEvent(String args) +155    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 


版本信息: Microsoft .NET Framework 版本:2.0.50727.3634; ASP.NET 版本:2.0.50727.3634

 

 

 

問題分析:

1、數據量大,同時使用人數多,請求量大、同時存在多個應用系統導致服務器負擔太大;

2、程序問題,沒注意優化,或導致死循環

3、數據庫配置的問題

4、IIS或程序配置的問題

 

解決方案:

1、修改web.config配置

加入

Pooling=True;Max Pool Size = 512
 

2、修改SQL Server配置

在服務器屬性中修改連接數的限制,將遠程查詢超時值設置為0

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM