zoukankan      html  css  js  c++  java
  • [原创]ASP.NET超时设置2

    1.IIS->[网站]->属性-》连接超时。默认为120秒
    2.WEB.CONFIG 手工添加httpRuntime,如
    <system.web>
     <httpRuntime maxRequestLength="1000000" executionTimeout="2000" />
    </system.web>
    3.同步执行WEBSERVICE时,需要设置TIMEOUT属性,如
     CompilerSvr.MyFavoritesService compiler=new FDN.DMS.Controls.CompilerSvr.MyFavoritesService(); 
       compiler.Timeout =2000000; //毫秒

    引用请声明本文来源http://www.cnblogs.com/linn/!!!

    如果使用FILL一个很大的数据到table或dataset
    DataTable retTable = new DataTable();
                retTable.TableName = tablename;
                SqlConnection con = new SqlConnection( m_SqlConnectionString );
                con.Open ();
                SqlDataAdapter sda = new SqlDataAdapter( sql, con );
                sda.Fill ( retTable );
                con.Close ();
                return retTable;

    即使你设置了connectstring <add key="connectionString" value="data source=(local);initial catalog=http://www.cnblogs.com/linn/;persist security info=False;user id=sa;password=;packet size=8192;Connection Timeout=600" />仍然会超时,这时只有使用CommandTimeout:
                SqlDataAdapter sda = new SqlDataAdapter();
                SqlCommand sqlcmd = new SqlCommand();
                DataSet dt = new DataSet();           
                SqlConnection con = new SqlConnection( m_SqlConnectionString );           
                con.Open ();
                sqlcmd.Connection = con;
                sqlcmd.CommandText = sql;
                sqlcmd.CommandTimeout = 600;
                //SqlDataAdapter sda = new SqlDataAdapter( sql, con );       
                sda.SelectCommand = sqlcmd;
                sda.Fill(dt) ;
                con.Close ();
                return dt.Tables[0];
  • 相关阅读:
    洛谷 P1024 一元三次方程求解
    洛谷 P1025 数的划分
    假期一测
    洛谷 P1032 字符变换
    洛谷 P1033 自由落体
    洛谷 P1063 能量项链
    洛谷 P1072 Hankson 的趣味题
    洛谷 P1040 加分二叉树
    1013: [JSOI2008]球形空间产生器sphere
    1013: [JSOI2008]球形空间产生器sphere
  • 原文地址:https://www.cnblogs.com/linn/p/737360.html
Copyright © 2011-2022 走看看