How to increase timeout for your ASP.NET Application ?
A. executionTimeout attribute of httpRuntime element (web.config):
ASP.NET will timeout the request, if it is not completed within “executionTimeout” duration value. And System.Web.HttpException: Request timed out exception will be thrown by ASP.NET Application.
executionTimeout attribute of httpRuntime element (in the web.config) can be used to change the request timeout duration for ASP.NET Application. executionTimeout value is specified in seconds. Default value is 110 seconds.
<configuration> <system.web> <httpRuntime targetFramework="4.5.1" executionTimeout="500" /> </system.web> </configuration>
B. timeout attribute of sessionState element (web.config):
If the user remains idle for duration specified in timeout attribute vaule of sessionState element (in web.config), then his session will expire.
timeout attribute of sessionState element (in the web.config) can be used to change session timeout duration for ASP.NET Application. timeout value is specified in minutes. Default value is 20 minutes.
<configuration> <system.web> <sessionState timeout="20"></sessionState> </system.web> </configuration>
C. Idle Time-out Settings for an Application Pool (IIS):
If the worker process remain idle for duration specified in Idle Time-out Settings for an Application Pool , then worker process will shut down.
Idle Time-out Settings for an Application Pool value is specified in minutes. The default value for Idle Time-out Settings for an Application Pool is 20 minutes.
D. SqlCommand.CommandTimeout (SQL SERVER):
ADO.NET will wait for duration specified in SqlCommand.CommandTimeout before cancelling the query.
using (var connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(queryString, connection); // Setting command timeout to 100 second command.CommandTimeout = 100; command.ExecuteNonQuery(); }
SqlCommand.CommandTimeout value is specified in seconds. The default value of SqlCommand.CommandTimeout is 30 seconds.
E. SqlConnection.ConnectionTimeout:
If connection is not opened within the duration specified in SqlConnection.ConnectionTimeout, timeout exception will be thrown.
Data Source=(local);Initial Catalog=TechCartNow;Integrated Security=SSPI;Connection Timeout=30
SqlConnection.ConnectionTimeout value is specified in seconds. The default value of SqlCommand.CommandTimeout is 15 seconds.
.NET Professional | Microsoft Certified Professional | DZone’s Most Valuable Blogger | Web Developer | Author | Blogger
Doctorate in Computer Science and Engineering
Microsoft Certified Professional (MCP) with over 12+ years of software industry experience including development, implementation & deployment of applications in the .NET framework
Experienced and skilled Agile Developer with a strong record of excellent teamwork, successful coding & project management. Specialises in problem identification and proposal of alternative solutions. Provided knowledge and individual mentoring to team members as needed
Among top 3% overall in terms of contribution on Stack Overflow (~2.3 million people reached my posts). Part of the top 1% Stack Overflow answerers in ASP.NET technology.
DZone’s Most Valuable Blogger (MVB)
Created and actively maintain the TechCartNow.com tech blog while also editing, writing, and researching topics for publication.
Excellent skills in Application Development using C#/Vb.Net, .NET Framework, ASP.NET, MVC, ADO.NET, WCF, WPF, Web API, SQL Server, jQuery, Angular, React, BackboneJS
Good summarize article.
Greate pieces. Keep posting such kind of info on your site.
Im really impressed by your site.
Hi there, You have done a fantastic job. I
will definitely digg it and in my opinion suggest to my friends.
I’m sure they will be benefited from this site.
Appreciate this post. Let me try it out.
great article
thank you, good article
Good one
thanks bro
Very shortly this web page will be famous among all
blogging visitors, due to it’s nice content
First of all I want to say terrific blog!
I had a quick question in which I’d like to ask if you do not mind.
I was interested to find out how you center yourself
and clear your mind before writing. I have had difficulty
clearing my thoughts in getting my thoughts out there. I do
enjoy writing however it just seems like the first 10 to 15
minutes are wasted just trying to figure out how to begin.
Any ideas or tips? Cheers!