Asp.net 网络表单 "The wait operation timed out"

Asp.net web form "The wait operation timed out"

我有一个 Web 表单,用于从报告服务器检索数据。我无权在我正在该服务器中查询的 table 上创建索引,并且查询在文本查找方面非常非常慢。我已经尝试优化查询中的内容,但速度会很慢。所以我需要找到一种方法来避免在网页本身中出现超时。我已经回顾了几个类似的问题,我设置了一个疯狂的高连接超时,但我仍然在单击按钮时等待操作超时。超时发生在 30 秒后,即使我设置了如此高的连接超时。我不知道它是否是网络配置,但我没有使用我的网络配置中定义的连接字符串,只是代码隐藏中的这个。查询在 SSMS 中不会超时,仅当从网络表单访问数据时(从技术上讲,它在连接字符串中使用我的登录凭据,因此不存在任何权限问题,其他部分 运行 没问题)。还有什么地方需要增加页面的超时时间吗?

连接字符串(un/pw 出于隐私原因删除):

server=lxxxxxx.resources.xxx; Initial Catalog=pxxxxxxxx;User ID=mfeXXXXX;Password=XXXXXX;Trusted_Connection=False; Connection Timeout=10000"

查询超时,如果有帮助的话:

 protected void btnSearchFeedback_Click(object sender, EventArgs e)
    {
        con.Open();
        SqlDataAdapter sdaFeedBack = new SqlDataAdapter("SELECT CTIR.portion_ID, IB.Item_ID as [Item ID], CTIR.Item_DBkey as [Item DB Key], CTIR.Feedback as [Feedback], CTA.date as [Date],CTA.Candidate_ID as [Candidate ID] FROM Canxxxxxxx CTIR WITH (NOLOCK) left join Ixxxxx IB WITH (NOLOCK) ON CTIR.xxxxx = IB.xxxxx left join Cxxxxxx CTA WITH (NOLOCK) ON CTxxxxxx = CTxxxxxxx where (ctir.portion_id in (" + portionIDTextBox.Text + ") ) AND (len(CTIR.Feedback) > 0) and CTA.Date  > '2015-02-01 00:00:00.000' order by [Date]", con);
        DataSet dtFeedBack = new DataSet();
        sdaFeedBack.Fill(dtFeedBack);
        ViewState["dtFeedback"] = dtFeedBack;
        rptFeedBack.DataSource = dtFeedBack;
        rptFeedBack.DataBind();
        con.Close();
    }

同样,为了安全起见,删除了 table 个名称。所以我想看看是否有另一个位置我需要将连接超时设置为更高的数字以避免 "Server Error in '/' Application. The wait operation timed out",或者这是需要在服务器端处理的东西吗?

这是准确的错误:

“/”应用程序中的服务器错误。

等待操作超时 说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。

异常详细信息:System.ComponentModel.Win32Exception:等待操作超时

堆栈跟踪: [Win32Exception (0x80004005): 等待操作超时]

[SqlException (0x80131904): 超时已过。在操作完成之前超时期限已过或服务器没有响应。] System.Data.SqlClient.SqlConnection.OnError(SqlException 异常,Boolean breakConnection,Action1 wrapCloseInAction) +2434922 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +5736592 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +285 System.Data.SqlClient.TdsParser.TryRun(RunBehavior 运行Behavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +3731 System.Data.SqlClient.SqlDataReader.TrySetMetaData(_SqlMetaDataSet metaData, Boolean moreInfo) +198 System.Data.SqlClient.TdsParser.TryRun(RunBehavior 运行Behavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +2852 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +58 System.Data.SqlClient.SqlDataReader.get_MetaData() +89 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior 运行Behavior, String resetOptionsString) +379 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior 运行Behavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +2026 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior 运行Behavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +375 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior 运行Behavior, Boolean returnStream, String 方法) +53 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior 行为,字符串方法) +240 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior 行为) +41 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior 行为) +12 System.Data.Common.DbDataAdapter.FillInternal(DataSet 数据集, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand 命令, CommandBehavior 行为) +139 System.Data.Common.DbDataAdapter.Fill(DataSet 数据集, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand 命令, CommandBehavior 行为) +136 System.Data.Common.DbDataAdapter.Fill(数据集数据集)+88 FeedBackForm.btnSearchFeedback_Click(Object sender, EventArgs e) in C:\Users\mfelchlin\Documents\Visual Studio 2015\WebSites\devFormsSite\FeedBackForm.aspx.cs:27 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9696694 System.Web.UI.WebControls.Button.RaisePostBackEvent(字符串事件参数)+204 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(字符串事件参数)+12 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35 System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,布尔 includeStagesAfterAsyncPoint)+1639

sdaFeedBack.SelectCommand.CommandTimeout=120; //or some other number of seconds.

设置连接超时决定了等待连接打开的时间,而不是命令执行的时间。