Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.. Problem RRS feed

  • Question

  • I am not asking for the solution but I want to know what is the reason why is it this problem is occurring.. This problem occurs randomly, it is like first attempt everything is ok then second error occur then another try it is ok again.. when i checked the logs here is the report.

    System.Data.SqlClient.SqlException: タイムアウトに達しました。操作が完了する前にタイムアウト期間が過ぎたか、またはサーバーが応答していません。
       場所 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       場所 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       場所 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       場所 System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       場所 System.Data.SqlClient.SqlDataReader.get_MetaData()
       場所 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       場所 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       場所 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       場所 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       場所 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       場所 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       場所 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
       場所 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       場所 System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
       場所 System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
       場所 受託情報作成.受託情報作成.createCSVFromTable(String filePath)

    Sorry if some words are japanese.. Hope someone will help me with this.. :)

    Wednesday, September 17, 2014 6:14 AM


  • Hello Eskie,

    >>when i checked the logs here is the report.

    From the report, it seems that it is a command timeout issue. For this error, it is usually caused by long running tasks or uncommitted transactions.

    For the first reason, since the default value for CommandTimeout is 30 seconds. So if the sent command is not completed during 30 seconds, it would throw this message.

    A workaround is to increase the time as setting the CommandTimeout to 180:

    SqlCommand command = new SqlCommand(queryString, connection);
    command.CommandTimeout = 180;

    Then the command would have enough time to be executed.

    For the uncommitted transactions scenario, this one is difficult, you need to find what and where they are and change your code or your stored procedures accordingly.

    For details, you could check this blog written by Michael Aspengren.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Fred Bao Friday, September 26, 2014 9:07 AM
    Thursday, September 18, 2014 1:40 AM