'System.Data.SqlClient.SqlException (The wait operation timed out) when debugging only
The code code works with smaller queries even on debug. I tried some larger queries, and it works with the server/live version but not when debugging with visual studio. I tried the same query with SSMS and it worked fine, pretty quick too.
The query is via a stored procedure:
using (SqlConnection conn = new SqlConnection(CONNECTION_STRING))
{
partialReport = conn.Query<MonthlyReporting>("PartialReport", new { ClassLevel = (int)instruct, StartDate = startDate, EndDate = endDate, IncludeMarried = includeMarried }, commandType: CommandType.StoredProcedure).ToList();
// program does stuff here
}
The full exception details is:
System.Data.SqlClient.SqlException
HResult=0x80131904
Message=Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.Source=.Net SqlClient Data Provider
StackTrace:
Cannot evaluate the exception stack traceInner Exception 1:
Win32Exception: The wait operation timed out
The code is identical between the Server and Debug versions of the code, and the debug database is the same as the server/live database (although a few days older). Likewise, the CONNECTION_STRING is different, pointing to the debug/live database respectively.
Once again, this DOES work even when debugging with smaller queries.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
