關鍵字: sql超時解決方法
在服務器端處理一些耗時很長的處理的時候,有時會遇到超時的情況。在無需發送響應到 IE 的時候,此問題無關大雅。但在需要處理完后發送響應的情況下,往往導致瀏覽器超時無響應。
由於生成統計表格需要很長時間,到下載的時候瀏覽器已超時。
解決:在統計時,同時打開一個請求下載的頁面,這個頁面會定時刷新,重復請求。在數據准備好的情況下,進行下載;未准備好的情況下,顯示提示語。
總結:對於這種長時間的會導致瀏覽器超時的處理,可以先在服務器方處理完,然后用異步的方式(瀏覽器重復詢問,異步通知等)方式來取得響應。
SQL超時解決方法
影響服務器產生超時的設置大致有:
1. Server.scrīpt Timeout,
2. Connection對象的CommandTimeOut屬性,
3. Command對象的CommandTimeOut屬性,
4. IE瀏覽器的設置.
Server.scrīptTimeout,默認值是90秒.
要增大它,在你的asp文件中加一句,如下:
Server.scrīptTimeout=999,
將頁面超時設為999秒.
最初我只設置Server.scrīptTimeout,
但仍會出現timeout錯誤,無論它的值設成都多大.
后在社區里看到一帖子,提到commandTimeout屬性,
於是查看Option Pack文檔,果然還有其他的timeout.
Connection對象和Command對象都有個CommandTimeOut屬性,
默認是30秒,如果你有一個耗時的查詢或數據處理,
很容易就超時了.要增大它,也很容易,創建對象后,
設置它的屬性,如下:
con.CommandTimeOut = 999,
設為999秒,其中con是一Connection對象.
如設為零,將無限等待,沒有這一timeout限制.
Command對象不會繼承Connection的這一屬性,
所以對可能超時的Command也要單獨設置CommandTimeout屬性.
最后IE也有個超時設置,5分鍾從服務器得不到數據,也超時.
這種情況可能很少碰到,
但當我把一10多萬查詢的結果保存為mdb文件時,
就遇到了.(至於保存的方法,請參看精華區中的一篇帖子.)
如何設置瀏覽器超時時間
setTimeout('window.close()',100) 其中100為毫秒 。在onload上面加上上面這段代碼,應該可以了
在HTML HEAD 中加
<meta http-equiv="REFRESH" content="900;url=TimeOut?OpenForm">
900是15分鍾時間。
TimeOut?OpenForm 是超時轉到的頁面
鏈接超時問題的瀏覽器端解決方案
How to change the default Keep-Alive Time-Out Value in IE
View products that this article applies to.
Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.
You may have to increase the default time-out value for persistent HTTP connections in Internet Explorer if you are using a Web program that must communicate with Internet Explorer over the same TCP/IP socket after one idle minute. To change the default time-out value for persistent HTTP connections in Internet Explorer, add a DWORD value that is named KeepAliveTimeout to the following registry key, and then set its value data to the time (in milliseconds) that you want Internet Explorer to wait before resetting an idle connection:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings
To do this, follow these steps: 1. Click Start, click Run, type regedit, and then click OK.
2. Locate and then click the following key in the registry:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings
3. On the Edit menu, point to New, and then click DWORD Value.
4. Type KeepAliveTimeout, and then press ENTER.
5. On the Edit menu, click Modify.
6. Type the appropriate time-out value (in milliseconds), and then click OK. For example, to set the time-out value to two minutes, type 120000.
7. Restart Internet Explorer.
If you set the KeepAliveTimeout value to less than 60,000 (one minute), you may have problems communicating with Web servers that require persistent HTTP connections. For example, you may receive a "Page cannot be displayed" error message.
If you must have a KeepAliveTimeout value higher than 120000 (two minutes), you must create an additional registry key and set its value equal to the KeepAliveTimeout value that you want. The additional registry key is ServerInfoTimeout. It is a DWORD with a value (in milliseconds) and in the same location as KeepAliveTimeout.
For example, to use a three-minute KeepAliveTimeout value, you must create the following registry keys:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings
KeepAliveTimeout DWORD value 180000 (in milliseconds)
ServerInfoTimeout DWORD value 180000 (in milliseconds)
By default, HTTP 1.1 is enabled in Internet Explorer except when you establish an HTTP connection through a proxy server. When HTTP 1.1 is enabled, HTTP connections remain open (or persistent) by default until the connection is idle for one minute or until the value that is specified by the KeepAliveTimeout value in the registry is reached. You can modify HTTP 1.1 settings in Internet Explorer by using the Advanced tab in the Internet Options dialog box.
由於生成統計表格需要很長時間,到下載的時候瀏覽器已超時。
解決:在統計時,同時打開一個請求下載的頁面,這個頁面會定時刷新,重復請求。在數據准備好的情況下,進行下載;未准備好的情況下,顯示提示語。
總結:對於這種長時間的會導致瀏覽器超時的處理,可以先在服務器方處理完,然后用異步的方式(瀏覽器重復詢問,異步通知等)方式來取得響應。
SQL超時解決方法
影響服務器產生超時的設置大致有:
1. Server.scrīpt Timeout,
2. Connection對象的CommandTimeOut屬性,
3. Command對象的CommandTimeOut屬性,
4. IE瀏覽器的設置.
Server.scrīptTimeout,默認值是90秒.
要增大它,在你的asp文件中加一句,如下:
Server.scrīptTimeout=999,
將頁面超時設為999秒.
最初我只設置Server.scrīptTimeout,
但仍會出現timeout錯誤,無論它的值設成都多大.
后在社區里看到一帖子,提到commandTimeout屬性,
於是查看Option Pack文檔,果然還有其他的timeout.
Connection對象和Command對象都有個CommandTimeOut屬性,
默認是30秒,如果你有一個耗時的查詢或數據處理,
很容易就超時了.要增大它,也很容易,創建對象后,
設置它的屬性,如下:
con.CommandTimeOut = 999,
設為999秒,其中con是一Connection對象.
如設為零,將無限等待,沒有這一timeout限制.
Command對象不會繼承Connection的這一屬性,
所以對可能超時的Command也要單獨設置CommandTimeout屬性.
最后IE也有個超時設置,5分鍾從服務器得不到數據,也超時.
這種情況可能很少碰到,
但當我把一10多萬查詢的結果保存為mdb文件時,
就遇到了.(至於保存的方法,請參看精華區中的一篇帖子.)
如何設置瀏覽器超時時間
setTimeout('window.close()',100) 其中100為毫秒 。在onload上面加上上面這段代碼,應該可以了
在HTML HEAD 中加
<meta http-equiv="REFRESH" content="900;url=TimeOut?OpenForm">
900是15分鍾時間。
TimeOut?OpenForm 是超時轉到的頁面
鏈接超時問題的瀏覽器端解決方案
How to change the default Keep-Alive Time-Out Value in IE
View products that this article applies to.
Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.
You may have to increase the default time-out value for persistent HTTP connections in Internet Explorer if you are using a Web program that must communicate with Internet Explorer over the same TCP/IP socket after one idle minute. To change the default time-out value for persistent HTTP connections in Internet Explorer, add a DWORD value that is named KeepAliveTimeout to the following registry key, and then set its value data to the time (in milliseconds) that you want Internet Explorer to wait before resetting an idle connection:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings
To do this, follow these steps: 1. Click Start, click Run, type regedit, and then click OK.
2. Locate and then click the following key in the registry:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings
3. On the Edit menu, point to New, and then click DWORD Value.
4. Type KeepAliveTimeout, and then press ENTER.
5. On the Edit menu, click Modify.
6. Type the appropriate time-out value (in milliseconds), and then click OK. For example, to set the time-out value to two minutes, type 120000.
7. Restart Internet Explorer.
If you set the KeepAliveTimeout value to less than 60,000 (one minute), you may have problems communicating with Web servers that require persistent HTTP connections. For example, you may receive a "Page cannot be displayed" error message.
If you must have a KeepAliveTimeout value higher than 120000 (two minutes), you must create an additional registry key and set its value equal to the KeepAliveTimeout value that you want. The additional registry key is ServerInfoTimeout. It is a DWORD with a value (in milliseconds) and in the same location as KeepAliveTimeout.
For example, to use a three-minute KeepAliveTimeout value, you must create the following registry keys:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings
KeepAliveTimeout DWORD value 180000 (in milliseconds)
ServerInfoTimeout DWORD value 180000 (in milliseconds)
By default, HTTP 1.1 is enabled in Internet Explorer except when you establish an HTTP connection through a proxy server. When HTTP 1.1 is enabled, HTTP connections remain open (or persistent) by default until the connection is idle for one minute or until the value that is specified by the KeepAliveTimeout value in the registry is reached. You can modify HTTP 1.1 settings in Internet Explorer by using the Advanced tab in the Internet Options dialog box.