如何处理超时事件? 1、IIS为一个死循的执行过程设定执行时间(缺省为90秒)超时事件: lt;%response.buffer=true%gt; lt;bodygt;lt;htmlgt; lt;% DO nbsp; counter=counter+1 nbsp; response.write counter "lt;brgt;" nbsp; response.flush LOOP %gt; lt;/bodygt;lt;/htmlgt;
2、自定义时间。用程序设定超时事件的时间段: lt;% response.buffer=true server.scripttimeout=20 %gt; lt;bodygt;lt;htmlgt; lt;% DO nbsp; counter=counter+1 nbsp; response.write counter "lt;brgt;" nbsp; response.flush LOOP %gt; lt;/bodygt;lt;/htmlgt; nbsp; 3、干涉超时时间段。捕获超时: lt;%@ trANSACTION=Required%gt; lt;% response.buffer=true server.scripttimeout=20 %gt; lt;htmlgt;lt;bodygt; lt;/bodygt; lt;% DO nbsp; counter=counter+1 nbsp; response.write counter "lt;brgt;" LOOP response.flush response.write "脚本运行完啦!" %gt; lt;/htmlgt; lt;% Sub OnTransactionAbort() nbsp; nbsp; nbsp; response.clear nbsp; nbsp; Response.Write "噢,脚本运行超时了!" end sub %gt;
nbsp;nbsp;nbsp; 4、绕过超时事件: lt;%@ trANSACTION=Required%gt; lt;% response.buffer=true server.scripttimeout=40 %gt; lt;htmlgt;lt;bodygt; lt;/bodygt; lt;% DOnbsp; UNTIL counter=400 nbsp; counter=counter+1 nbsp; response.write counter "lt;brgt;" LOOP response.flush response.write "脚本运行完啦!" %gt; lt;/htmlgt; lt;% Sub OnTransactionAbort() nbsp; nbsp; nbsp; response.clear nbsp; nbsp; Response.Write "噢,脚本运行超时了!" end sub %gt; nbsp; (编辑:淮北站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|