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. PAT Basic 1048 数字加密 (20 分)

    本题要求实现一种数字加密方法.首先固定一个加密用正整数 A,对任一正整数 B,将其每 1 位数字与 A 的对应位置上的数字进行以下运算:对奇数位,对应位的数字相加后对 13 取余——这里用 J 代表 ...

  2. Linux之文件属性、权限

    Linux中的3种身份:1. owner(文件所有者) 2. group(用户组) 3. others(其他) Linux中的3中权限:1. r(可读) 2. w(可写) 3. x(可执行) * 所有 ...

  3. bzoj4383 [POI2015]Pustynia 拓扑排序+差分约束+线段树优化建图

    题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=4383 题解 暴力的做法显然是把所有的条件拆分以后暴力建一条有向边表示小于关系. 因为不存在零环 ...

  4. windows javaee 安装

    一. 下载jdk 并安装 二. 配置环境变量 JAVA_HOME:D:\Java\jdk1..0_25 CLASSPATH :.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt. ...

  5. Django【第24篇】:JS实现的ajax和同源策略

    JS实现的ajax和同源策略 一.回顾jQuery实现的ajax 首先说一下ajax的优缺点 优点: AJAX使用Javascript技术向服务器发送异步请求: AJAX无须刷新整个页面: 因为服务器 ...

  6. AI人工智能对医疗行业有哪些巨大贡献?

    人工智能(AI)有可能显着改变医生的角色并彻底改变医学实践.这篇定性评价文章总结了过去12个月的人工智能健康研究,涉及不同的医学专业,并讨论了与这一新兴技术相关的当前优势和挑战. 医生,特别是担任领导 ...

  7. unittest----skip(跳过用例)

    我们在执行测试用例时,有时有些用例时不需要执行的,这时就需要用到unittest给我们提供的跳过用例的方法 @unittest.skip(reason):强制跳过,不需要判断条件.reason是跳过原 ...

  8. 使用layui iframe弹层,各弹层之前的传值问题

    最近做一个后台管理系统,用到的layui,主要是使用它的弹层,但是各个弹层之前的传值经常容易搞晕,写个个博客记录一下,方便自己,也方便别人, 首先我的页面已经嵌套了好几个iframe页面了,嵌套了三个 ...

  9. vs 2010创建Windows服务定时timer程序

    vs 2010创建Windows服务定时timer程序: 版权声明:本文为搜集借鉴各类文章的原创文章,转载请注明出处:  http://www.cnblogs.com/2186009311CFF/p/ ...

  10. 弹性盒子FlexBox简介(二)

    弹性盒子属性 一.align-content属性 属性作用:用于修改flex-wrap属性行为.类似于justify-content,但它不是设置弹性子元素的对齐,而是设置各个行的对齐. 属性值: f ...