wait for response from sql server

摘要:wait for response from sql server

I thought I should modify the value of the connectionTimeout. But I was wrong.
The answers to this question are :

1. set the value of the sqlcommand.commandtimeout
2. set the value of 'remote query timeout' in the sql server
3. set  the value of the httpRuntime in the web.config or Machine.config 

4. asp.net ajax skill (Updatepanel+Timer to refresh the user pages)

Reference:

part1:
SqlConnection.ConnectionTimeout:
取得在終止嘗試並產生錯誤前嘗試建立連接的等待時間.
等待連接開啟的時間 (以秒為單位)。
預設值為 15 秒。
SqlCommand.CommandTimeout :
取得或設定結束執行命令的嘗試並產生錯誤之前的等待時間。
等待命令執行的時間 (以秒為單位)。
預設值為 30 秒。

Part2:
USE master
GO
EXEC sp_configure 'remote query timeout', 6000
GO
RECONFIGURE
GO


Part3:
web.config :
<configuration>
<system.web>
<httpRuntime   executionTimeout="36000"  />
</system.web>
</configuration>
 Machine.config:
1. 在文字編輯器開啟 Machine.config 文件。
    Machine.config 位於 %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\ 資料夾下 
2. Machine.config 文件, 中找到 httpRuntime 元素。 
3. 修改 executionTimeout 的值。  
4. 儲存 Machine.config 文件。 

***important***
1. This setting will take effect only when we set the "debug" to false in
web.config , like:

<compilation
defaultLanguage="c#"
debug="false"
/>

when set to "debug=true" mode, the runtime will ignore the timeout setting.

2. Even we set the debug="false", the executionTimeout will still has some
delay when the value is very small. In fact, it is recommeded that we don't
set the timeout less than 1.5 minutes. And when we set the timeout to less
than 1 minute, the delay will span from 5 secs up to 15 secs. For example,
if we set executionTimeout="5", it may take a bout 15 seconds for the page
to timeout.
 

Source: http://www.velocityreviews.com/forums/t101706-scripttimeout-and-executiontimeout-do-not-work.html
               http://blog.csdn.net/kwmxw/archive/2008/07/30/2739629.aspx