ScriptTimeout and executionTimeout do not work


A

Arsen V.

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

I first tried using the Server.ScriptTimeout = 2 in the Page_Load() event.
The next line does System.Threading.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
executionTimeout attribute to 2 like this:

<httpRuntime executionTimeout="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.
 
Ad

Advertisements

S

Steven Cheng[MSFT]

Hi Arsen,

Welcome to ASP.NET newsgroup.
As for the executionTimeout 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 executionTimeout 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 executionTimeout="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.)
 
A

Arsen V.

Hi Steven,

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

Do you know why Server.ScriptTimeout 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, executionTimeout (and
Server.ScriptTimeout?) will not help... Is there a work around?

Thanks,
Arsen V.
 
Ad

Advertisements

S

Steven Cheng[MSFT]

Thanks for your reply Arsen,

The reason I didn't suggest use Server.ScriptTimeout property is because
this is a COM interface which is used in classic ASP. The executionTimeout
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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top