Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC and httpRuntime executionTimeout

I would like to increase the httpRuntime executionTimeout for a subsection of an ASP.NET MVC application.

In a regular Web App, you could use:

<configuration>   <location path="UploadPage.aspx">     <httpRuntime executionTimeout="600"/>   </location> </configuration> 

However there really is not the idea of "Folders" in ASP.NET MVC, so how would I go about doing this?

Lets assume the ASP.NET MVC path is /Images/Upload with an ImagesController and Upload Action.

like image 541
E Rolnicki Avatar asked Jan 29 '09 16:01

E Rolnicki


People also ask

What is httpRuntime executionTimeout?

The executionTimeout attribute of <httpRuntime> defines the maximum amount of time in seconds that a request is allowed to run before it is automatically terminated by ASP.NET. The default value is 90 seconds.

What is httpRuntime in web config?

The HttpRuntimeSection allows you to handle those parameters that affect the behavior of the ASP.NET runtime. It refers to the node in the configuration file that is indicated by the <httpRuntime> element and can be used at any level in the configuration hierarchy.

What is the maximum execution timeout in web config?

Adjustments to ASP.Net configuration Increase the timeout span for your web application. Add or edit the executionTimeout attribute, giving it a higher value. The default value is 110 seconds and the maximum value is 999999 seconds.

How can change session timeout in ASP NET MVC?

Open the web. config file, then increase the value in minutes by using the time out attribute of SessionState element. By default, the session timeout value is 20 minutes. Also in your case if you are using forms authentication, please check the timeout value.


2 Answers

You can include the whole MVC path (controller and action) in the <location> tag's path attribute. Something like this should work:

<location path="Images/Upload">     <system.web>         <httpRuntime executionTimeout="600" />     </system.web> </location> 
like image 190
Chris Hynes Avatar answered Sep 20 '22 20:09

Chris Hynes


Chris Hynes solution works! Just be sure to not include ~/ in your path.

This answer details another way - simply set the ScriptTimeout within your action code:

public ActionResult NoTimeout() {     HttpContext.Server.ScriptTimeout = 60 * 10; // Ten minutes..     System.Threading.Thread.Sleep(1000 * 60 * 5); // Five minutes..     return Content("NoTimeout complete", "text/plain"); // This will return.. } 
like image 33
Jarrod Dixon Avatar answered Sep 20 '22 20:09

Jarrod Dixon