ASP.NET - How can we increase the Timeout of a Thread from web.config?

Asked By Burak Gunay on 03-Aug-09 10:46 AM

From http://suprej-venkat.blogspot.com/2007/10/i-had-to-create-custom-web-part-that.html

" I found out that the system was throwing this exception and it was because

 by default .Net threads have an execution time out limit of 110 seconds. To fix this we need to modify the web.config file that Sharepoint uses. "

How can we increase the thread timeout from our web.config file?

Thanks,

Burak

Santhosh N replied to Burak Gunay on 03-Aug-09 11:32 AM

check this one to understand and how to set timeout in web.config..

http://www.dotnet247.com/247reference/msgs/35/177105.aspx

where does it say anything about the default thread timeout? - Burak Gunay replied to Santhosh N on 03-Aug-09 11:50 AM

the webpage I am launching the thread already has this setting in web.config

<location path="Thread.aspx">

   <system.web>

      <httpRuntime executionTimeout="600"/>

   </system.web>

</location>

but I don't know about any other timeout property particular to threads.

Where did the 110 seconds figure come about? How can we change it?

I guess he is referring to the ExecutionTimeOut property of httpRunTime

Burak Gunay replied to Santhosh N on 03-Aug-09 12:23 PM
http://msdn.microsoft.com/en-us/library/e1f13641.aspx
You can change the web.config as per below setting. - [)ia6l0 iii replied to Burak Gunay on 03-Aug-09 01:07 PM
However, i would appreciate if you read thru ..to get the exact understanding of how & when it would work.

Firstly, you need to increase the timeout of the executionTimeout attribute of the httpRuntime element. Note that this is mentioned in Seconds unlike the other timeout  attributes like the Session timeout and others.

<httpRuntime
    executionTimeout="36000"


And moreover, this attribute takes effect only when you set the debug attribute of the Compilation element to false. This is also specified in the MSDN link that you mentioned. Like,

<compilation
   debug="false"
../>

But this works in conjunction with the Session timeout. Yes, if the session times out , then an error would be thrown. and it wouldn't wait for the executionTimeout value to  take effect. so you also need to set the Session Timeout to a higher value. And note that this is in minutes. which would look like,

<sessionState
    mode="InProc"
    timeout="360"
    ...
    />


And note that all of this would be overriden by AppPool recycling process. so you need to set the Idle Timeout value of the Apppool that your website uses to atleast same / higher value than the session timeout.