C# program return "Execution Timeout Expired. The timeout period slapsed prior to completion of the operation or the server is not responding."
C# Program throw "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.".
The inner exception message is "The wait operation timed out.".
using (var connection = new SqlConnection(ConnectionString))
{
DataSet ds = new DataSet();
try
{
SqlCommand cmd = new SqlCommand("stored_procedure_name", connection);
cmd.Parameters.Add("@param1", SqlDbType.VarChar).Value = in_value;
cmd.CommandType = CommandType.StoredProcedure;
using (SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd))
{
dataAdapter.Fill(ds);
}
}
catch (Exception ex)
{
Log.Write(ex.Message);
if (ex.InnerException != null)
Log.Write(ex.InnerException.Message);
}
}
The stored procedure selects the records and then updates the status of the records.
Normally, the number of records is about 200 rows.
The SQL Server and the program are running on separate machines.
The program is running for a few years. The above timeout message throws randomly. It is not related to the number of selected records.
According to the log, from calling to exception throw is within 2 mins.
From the SQL Server log, no deadlock. system_idel and memory_utilization are normal.
From the system event log, no error or warning within the error throw period.
No idea of the timeout reason.