网站运行一段时间(一周或者大几天吧),就会报一下错误:Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. 网上说是CommandTimeout ,sqlhelper的问题,不知大家是怎么看的,各位仁者见仁,发表下意见及解决办法,thx...

解决方案 »

  1.   

    webconfig里面配下sql超时时间长点试试
      

  2.   

    SqlConnection.ConnectionTimeout 设置长一点呢
      

  3.   

    webconfig里面配下sql超时时间长点
      

  4.   

    在做web的时候,与数据库打交道经常需要建立数据库连接。为了移植方面肯定都会用统一的连接字符串。在sqldatasource里可以这样来读取web.config的<connectionStrings> 里的字符串:<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>"
    其中web.config里的相关内容为:<connectionStrings>
      <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" 
    connectionString="Data Source=(local);Initial Catalog=pubs;Persist Security Info=True;User ID=sa;Password=123" 
    providerName="System.Data.SqlClient"/>
     </connectionStrings>
      

  5.   

    <appSettings>   
      <add   key="DBConnStr"   value="server=hyperion;User   ID=sa;Password=sa;database=northwind;Connect   Timeout=30;"   />   
          </appSettings>