locked
Query timeout but no error? RRS feed

  • Question

  • User606090160 posted

    Hello all, i have this query that i have stored as a function on the db and call it via sqldatasource.  The query is big and works in the test environment but not in ptoduction, it produces no timeout error message it just doesnt render the grid at all (which is a Radgrid BTW).  This is what i've done so far.  The query works i tested it on management studio on the production machine although it took 44 seconds, it did compile.  Any ideas/Help appreciated!

    protected void SqlGrade9CH4_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
            {
                e.Command.CommandTimeout = 0;
            }

    in the connnection string of the webconfig i added..

    Connection Timeout=60

     

     

    Thursday, April 24, 2014 1:54 AM

Answers

  • User606090160 posted

    thanks for the reponse apparently the issue was with the database for the tables affected were not indexed....thanks for the help i will reference your suggested code

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 28, 2014 11:26 AM

All replies

  • User724169276 posted

    Hello,

    Apart from your web.config.Assuming you deployed using iis, you may have to change the timeout settings from iis also.Like Below:

    1. Open your IIS
    2. Now explore your Application Pools menu and Sites
    3. Now mouse right click then click on Manage Web Site & then sub menu on Advanced Settings
    4. Now a window will popup now click on section Connection Limits
    5. Here you can set your Connection Time-out (seconds).

    Thursday, April 24, 2014 2:36 AM
  • User606090160 posted

    thanks for the suggestion, still didnt work....I did however disabled my loading panel and now i am recieving an error.

    The wait operation timed out

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.ComponentModel.Win32Exception: The wait operation timed out
    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [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) +392
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515
       System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
       System.Data.SqlClient.SqlDataReader.get_MetaData() +138
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6738869
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +6741487
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +586
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +107
       System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +288
       System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +180
       System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +21
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +325
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +420
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +280
       System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +3607911
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +28
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +313
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +146
       System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +35
       System.Web.UI.Control.PreRenderRecursiveInternal() +113
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297
    
    Thursday, April 24, 2014 9:33 AM
  • User1918509225 posted

    Hi kristofour,

    About your problem,please try to set your Command Timeout in entity framework,just like below:

       using System.Data.Entity;
        using System.Data.Entity.Infrastructure;
    
        public class YourContext : DbContext
        {
          public YourContext()
            : base("YourConnectionString")
          {
            // Get the ObjectContext related to this DbContext
            var objectContext = (this as IObjectContextAdapter).ObjectContext;
    
            // Sets the command timeout for all the commands
            objectContext.CommandTimeout = 120;
          }
        }
    
    

    Hope it can help you.


    Best Regards,

    Kevin Shen.

    Friday, April 25, 2014 3:58 AM
  • User606090160 posted

    thanks for the reponse apparently the issue was with the database for the tables affected were not indexed....thanks for the help i will reference your suggested code

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 28, 2014 11:26 AM