我正在运行一个ASP.NET网页页面,在初始加载时从SQL服务器中提取项目列表.此查询在大约一秒钟内运行,并在2秒内加载页面.返回约1000条记录,给予或接受.我从Service Manager SQL数据库中提取Hostnames以及其他一些信息.
在这个页面中,我有一个内置的搜索,它基本上运行完全相同的查询,但使用基于主机名的LIKE运行它.这将加载包含搜索查询一部分的所有主机名的同一页面.查询通常在一秒钟内在SQL Management Studio中运行,但加载页面需要更长时间,有时会超时.
我的问题是,为什么基于参数的搜索需要更长的时间,有时会因为没有明显原因而超时.是否有任何步骤可以缓解此超时?以下是完整错误.
'/'应用程序中的服务器错误.
The wait operation timed out
Run Code Online (Sandbox Code Playgroud)
描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
例外细节:
System.ComponentModel.Win32Exception: The wait operation timed out
Source Error:
Line 13: }
Line 14:
Line 15: var selectedData = db.Query(selectCommand, searchTerm);
Line 16:
Line 17:
Source File: c:\Users\u0149920\Documents\My Web Sites\AppSupport\servers\default.cshtml Line: 15
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
[Win32Exception (0x80004005): The wait operation timed out]
[SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) …Run Code Online (Sandbox Code Playgroud)