ScriptTimeout and executionTimeout do not work

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Arsen V.

    ScriptTimeout and executionTimeout do not work

    I am trying to make the page execute timeout after 2 seconds.

    I first tried using the Server.ScriptTi meout = 2 in the Page_Load() event.
    The next line does System.Threadin g.Thread.Sleep( 10000); // 10 second pause

    I was expecting the page to timeout with a Request timeout error. However,
    it did not timeout and continue to execute for the full 10 seconds.

    Next, I tried to use the <httpRuntime> configuration to set the
    executionTimeou t attribute to 2 like this:

    <httpRuntime executionTimeou t="2"/>

    In the Web.config file. However this did not help either.

    How can I force my ASPX page to timeout after 2 seconds?

    Thanks,
    Arsen V.


  • Steven Cheng[MSFT]

    #2
    RE: ScriptTimeout and executionTimeou t do not work

    Hi Arsen,

    Welcome to ASP.NET newsgroup.
    As for the executionTimeou t setting for ASP.NET's <httpRuntime>
    configuration not work problem. First I should admit that the
    documentation on this attribute is really not very clear. The problem is
    caused by the following reasons:

    1. This setting will take effect only when we set the "debug" to false in
    web.config , like:

    <compilation
    defaultLanguage ="c#"
    debug="false"
    />

    when set to "debug=true " mode, the runtime will ignore the timeout setting.


    2. Even we set the debug="false", the executionTimeou t will still has some
    delay when the value is very small. In fact, it is recommeded that we don't
    set the timeout less than 1.5 minutes. And when we set the timeout to less
    than 1 minute, the delay will span from 5 secs up to 15 secs. For example,
    if we set executionTimeou t="5", it may take a bout 15 seconds for the page
    to timeout.

    Hope helps.

    Thanks & Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)







    Comment

    • Arsen V.

      #3
      Re: ScriptTimeout and executionTimeou t do not work

      Hi Steven,

      Thanks for the follow up. I will try to test by setting "debug" to "false".

      Do you know why Server.ScriptTi meout does not work? Or is it also affected
      by the "debug" value in the Web.config file.

      Finally, if I want to have the script ALWAYS terminate after 2 seconds, what
      can I do? Based on what you say, executionTimeou t (and
      Server.ScriptTi meout?) will not help... Is there a work around?

      Thanks,
      Arsen V.

      "Steven Cheng[MSFT]" <v-schang@online.m icrosoft.com> wrote in message
      news:bxpzoLVTFH A.3336@TK2MSFTN GXA01.phx.gbl.. .[color=blue]
      > Hi Arsen,
      >
      > Welcome to ASP.NET newsgroup.
      > As for the executionTimeou t setting for ASP.NET's <httpRuntime>
      > configuration not work problem. First I should admit that the
      > documentation on this attribute is really not very clear. The problem is
      > caused by the following reasons:
      >
      > 1. This setting will take effect only when we set the "debug" to false in
      > web.config , like:
      >
      > <compilation
      > defaultLanguage ="c#"
      > debug="false"
      > />
      >
      > when set to "debug=true " mode, the runtime will ignore the timeout[/color]
      setting.[color=blue]
      >
      >
      > 2. Even we set the debug="false", the executionTimeou t will still has some
      > delay when the value is very small. In fact, it is recommeded that we[/color]
      don't[color=blue]
      > set the timeout less than 1.5 minutes. And when we set the timeout to[/color]
      less[color=blue]
      > than 1 minute, the delay will span from 5 secs up to 15 secs. For example,
      > if we set executionTimeou t="5", it may take a bout 15 seconds for the page
      > to timeout.
      >
      > Hope helps.
      >
      > Thanks & Regards,
      >
      > Steven Cheng
      > Microsoft Online Support
      >
      > Get Secure! www.microsoft.com/security
      > (This posting is provided "AS IS", with no warranties, and confers no
      > rights.)
      >
      >
      >
      >
      >
      >
      >[/color]


      Comment

      • Steven Cheng[MSFT]

        #4
        Re: ScriptTimeout and executionTimeou t do not work

        Thanks for your reply Arsen,

        The reason I didn't suggest use Server.ScriptTi meout property is because
        this is a COM interface which is used in classic ASP. The executionTimeou t
        of ASP.NET is the replacement of ScriptTimeout in asp.net , so we no longer
        need to use ScriptTimeout in asp.net.

        In addition, as for
        =============== ===
        have the script ALWAYS terminate after 2 seconds
        =============== ===

        I'm afraid there is no means in asp.net's runtime setting since the
        asp.net's runtime request processing management can't reach this level of
        accuracy, 2 seconds is a too small value which may make the performance
        very pool to monitor such a small internval. If we do need to let a
        certain processing timeout, we can consider put the timeout logic in the
        above application code level. For example, if we're executing SqlCommand ,
        we can set the sqlcommand 's execution timeout. Or if we are executing a
        async call in page code, we can set a timeout for the async call.....

        Thanks,

        Steven Cheng
        Microsoft Online Support

        Get Secure! www.microsoft.com/security
        (This posting is provided "AS IS", with no warranties, and confers no
        rights.)

        Comment

        Working...