如何處理逾時事件?
1、IIS為一個死循的執行過程設定執行時間(預設為90秒)逾時事件:
<%response.buffer=true%>
<body><html>
<%
DO
counter=counter+1
response.write counter & "<br>"
response.flush
LOOP
%>
</body></html>
2、自訂時間。用程式設定逾時事件的時間段:
<%
response.buffer=true
server.scripttimeout=20
%>
<body><html>
<%
DO
counter=counter+1
response.write counter & "<br>"
response.flush
LOOP
%>
</body></html>
3、幹涉逾時時間段。捕獲逾時:
<%@ trANSACTION=Required%>
<%
response.buffer=true
server.scripttimeout=20
%>
<html><body>
</body>
<%
DO
counter=counter+1
response.write counter & "<br>"
LOOP
response.flush
response.write "指令碼運行完啦!"
%>
</html>
<%
Sub OnTransactionAbort()
response.clear
Response.Write "噢,指令碼運行逾時了!"
end sub
%>
4、繞過逾時事件:
<%@ trANSACTION=Required%>
<%
response.buffer=true
server.scripttimeout=40
%>
<html><body>
</body>
<%
DO UNTIL counter=400
counter=counter+1
response.write counter & "<br>"
LOOP
response.flush
response.write "指令碼運行完啦!"
%>
</html>
<%
Sub OnTransactionAbort()
response.clear
Response.Write "噢,指令碼運行逾時了!"
end sub
%>