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. CRMEasy知识库访问权限

    知识库设置BCCBINFO文件夹为共享文件夹,给予普通域用户和管理员域用户完全控制权限,但是当以管理员域用户身份对文件进行操作后,以普通域用户登录不会有效果,甚至出现“访问权限”的错误,这是由于文件夹 ...

  2. wepy相关

    1.根据官方文档: $ npm install @wepy/cli -g # 全局安装 WePY CLI 工具 $ wepy init standard myproj # 使用 standard 模板 ...

  3. MYSQL数据导出与导入,secure_file_priv参数设置

    https://www.imooc.com/article/41883 MySQL 报错 [Code: 1290, SQL State: HY000]  The MySQL server is run ...

  4. sharepoint 2010 创建自定义的ASP.NET Web Service (上)

    项目背景 根据客户需求在SharePoint 2010 中创建自定义的ASP.NET Web Service可以分为3种方式(我所知道的).废话少说,下面一一列举: 创建方式 MSDN 官方博客自己的 ...

  5. java web 增加信息课堂测试00

    按照图片要求设计添加新课程界面.(0.5分)在后台数据库中建立相应的表结构存储课程信息.(0.5分)实现新课程添加的功能.要求判断任课教师为王建民.刘立嘉.刘丹.王辉.杨子光五位教师的其中一位.(0. ...

  6. 决策树剪枝算法-悲观剪枝算法(PEP)

    前言 在机器学习经典算法中,决策树算法的重要性想必大家都是知道的.不管是ID3算法还是比如C4.5算法等等,都面临一个问题,就是通过直接生成的完全决策树对于训练样本来说是“过度拟合”的,说白了是太精确 ...

  7. css 上下居中的广法

    方法1 .text{ text-align:center; font-size:0; } .text span{ vertical-align:middle; display:inline-block ...

  8. Oracle RAC业务bug导致部分数据丢失处理

    问题描述:业务部门在10月26日发现某张基础表中丢失部分数据,系为9月份录入系统的基础数据丢失 Oracle RAC环境做的RMAN备份,10月18日做过expdp数据泵备份,丢失数据表名为T_GL_ ...

  9. 解决Intellij IDEA中项目不能识别yml配置文件

    问题:能读取资源路径下的properties配置文件但是不能读yml配置文件 因为无法读取配置yml配置文件,所以不能配置bean,导致项目启动报错. 解决方法: 在VM options中设置虚拟机加 ...

  10. Day_04-数组,元组,列表

    # for i in range(5): # for j in range(5): # print(i,j) # import re # def rm(): # a = ' 1 2 3 4 5 ' # ...