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.
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.
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.
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.
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.
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>
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.. }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With