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. python3-多重继承

    继承是面向对象编程的一个重要的方式,因为通过继承,子类就可以扩展父类的功能. 回忆一下Animal类层次的设计,假设我们要实现以下4种动物: Dog - 狗狗: Bat - 蝙蝠: Parrot - ...

  2. C#基础知识之Ref Out Params 4种类型的参数

    一.按值传递参数 值参数是通过将实参的值复制到形参,来实现按值传递到方法,也就是我们通常说的按值传递. 方法被调用时,CLR做如下操作: 1.在托管栈中为形参分配空间: 2.将实参的值复制到形参. 这 ...

  3. 数列前n项和

    等差数列 等比数列 常见的前n项和

  4. 【GDOI2014模拟】网格

    题目 某城市的街道呈网格状,左下角坐标为A(0, 0),右上角坐标为B(n, m),其中n >= m.现在从A(0, 0)点出发,只能沿着街道向正右方或者正上方行走,且不能经过图示中直线左上方的 ...

  5. LeetCode--617--合并二叉树(python)

    给定两个二叉树,想象当你将它们中的一个覆盖到另一个上时,两个二叉树的一些节点便会重叠. 你需要将他们合并为一个新的二叉树.合并的规则是如果两个节点重叠,那么将他们的值相加作为节点合并后的新值,否则不为 ...

  6. 2019年开发App记录

    Pod 制作私有库参考 https://www.jianshu.com/p/f903ecf8e882 Pod私有库的升级 改代码部分,到Example文件夹执行pod install ,修改XXX.s ...

  7. 2017乌鲁木齐网络赛 J题 Our Journey of Dalian Ends ( 最小费用最大流 )

    题目链接 题意 : 给出一副图,大连是起点,终点是西安,要求你求出从起点到终点且经过中转点上海的最小花费是多少? 分析 : 最短路是最小费用最大流的一个特例,所以有些包含中转限制或者经过点次数有限制的 ...

  8. 为什么阿里巴巴要禁用Executors创建线程池?

    作者:何甜甜在吗 juejin.im/post/5dc41c165188257bad4d9e69 看阿里巴巴开发手册并发编程这块有一条:线程池不允许使用Executors去创建,而是通过ThreadP ...

  9. Activiti组任务(十)

    1 Candidate-users 候选人 1.1需求 在流程定义中在任务结点的 assignee 固定设置任务负责人,在流程定义时将参与者固定设置在.bpmn 文件中,如果临时任务负责人变更则需要修 ...

  10. 【转】解决ajax跨域问题的5种解决方案

    转自: https://blog.csdn.net/itcats_cn/article/details/82318092   什么是跨域问题?跨域问题来源于JavaScript的"同源策略& ...