How to increase timeout for your ASP.NET Application ?

原文链接:https://www.techcartnow.com/increase-timeout-asp-net-application/

对于application主要有3种方式,对于sql主要有2种方式

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.

 
 
1
2
3
4
5
<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.

 
 
1
2
3
4
5
<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.

 
 
1
2
3
4
5
6
7
8
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.

 
 
1
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.

How to increase timeout for your ASP.NET Application ?的更多相关文章

  1. Why does the memory usage increase when I redeploy a web application?

    That is because your web application has a memory leak. A common issue are "PermGen" memor ...

  2. ASP.NET Application Life Cycle

    The table in this topic details the steps performed while an XAF ASP.NET application is running. Not ...

  3. ASP.NET Application and Page Life Cycle

    ASP.NET Application Life Cycle Overview for IIS 7.0 https://msdn.microsoft.com/en-us/library/bb47025 ...

  4. Debug your ASP.NET Application while Hosted on IIS

    转摘:http://www.codeproject.com/Articles/37182/Debug-your-ASP-NET-Application-while-Hosted-on-IIS This ...

  5. ASP.NET Application,Session,Cookie和ViewState等对象用法和区别 (转)

    在ASP.NET中,有很多种保存信息的内置对象,如:Application,Session,Cookie,ViewState和Cache等.下面分别介绍它们的用法和区别. 方法 信息量大小 作用域和保 ...

  6. Custom ASP.NET Application into SharePoint --整合ASP.NET应用程序到SharePoint

    转:http://www.devexpertise.com/2009/02/18/integrating-a-custom-aspnet-application-into-sharepoint-par ...

  7. [转]ASP.net Application 生命周期事件

    生命周期事件和 Global.asax 文件 在应用程序的生命周期期间,应用程序会引发可处理的事件并调用可重写的特定方法.若要处理应用程序事件或方法,可以在应用程序根目录中创建一个名为 Global. ...

  8. php仿照asp实现application缓存的代码分享

    php 怎么没有asp 那样的application缓存呢?最近我找了很多,都只有自己写,下面我分享一段代码 class php_cache{ //相对或者绝对目录,末尾不要加 '/' var $ca ...

  9. Capturing ASP.NET Application Startup Exceptions

    It has become common practice to perform tasks during an ASP.NET applications start up process. Thes ...

随机推荐

  1. VB程序设计中Combobox的取值问题

    Private a As Double   Private Sub Combo1_Click()    '1位小数,系数用10    a = Combo1.ItemData(Combo1.ListIn ...

  2. UVa11538 A Chess Queen

    A Chess Queen Problem A Chess Queen  Input: Standard Input Output: Standard Output You probably know ...

  3. GUI学习之二十一——QSlider、QScroll、QDial学习总结

    上一章我们学习了QAbstractSlider的用法,在讲功能的时候我们是借助了它的子类QSlider来实现的,今天来学习一下它的三个子类——QSlider.QScroll和QDial. 一.QSli ...

  4. linux如何在shell中自动生成1到100的数组

    之前自己在写shell脚本的时候,需要自动创建1-100的文本确不知道该如何去创建.百度一翻终于知道了创建的方法. 在shell脚本中创建1-100的方法很多,那我在这里主要就说两种容易理解且方便的方 ...

  5. QueryDSL通用查询框架学习目录

    转载自恒宇的博客 https://www.jianshu.com/p/99a5ec5c3bd5

  6. webpack Entrypoint undefined = index.html

    报错: module.exports增加配置stats: { children: false }即可解决:

  7. LTE抛弃了CDMA?

    原文链接:https://blog.csdn.net/readhere/article/details/82764919 本文节选自<LTE教程:结构与实施> 大家都听说过这样的说法:LT ...

  8. Windows上安装Apache

    1.下载 (1)进入Apache官网http://httpd.apache.org— (2)点击Download (3)点击Files for Microsoft Windows (4)点击Apach ...

  9. window 下 Atom 侧边栏字体大小设置

    在 File 处找到 Settings 点击 找到 Themes 点击 找到 your stylesheet 点击 在 .tree-view 处设置即可, (按照 css 样式来写即可保存生效).

  10. Redis分布式锁服务

    阅读目录: 概述 分布式锁 多实例分布式锁 总结 概述 在多线程环境下,通常会使用锁来保证有且只有一个线程来操作共享资源.比如: object obj = new object(); lock (ob ...