Recursion 如何在经典ASP中延迟部分脚本的执行?
我有一个典型的ASP页面,它调用一个en外部Web服务。 这就是实际过程的工作原理:Recursion 如何在经典ASP中延迟部分脚本的执行?,recursion,asp-classic,sleep,webservice-client,thread-sleep,Recursion,Asp Classic,Sleep,Webservice Client,Thread Sleep,我有一个典型的ASP页面,它调用一个en外部Web服务。 这就是实际过程的工作原理: '[Part0 : Call the external webservice] wsResponse = setConfirmation(...) ' [PART1: external webservice is responding] if not wsResponse is Nothing then '....Process the response from the webservice a
'[Part0 : Call the external webservice]
wsResponse = setConfirmation(...)
' [PART1: external webservice is responding]
if not wsResponse is Nothing then
'....Process the response from the webservice according to wsResponse
code =wsResponse.getCode
if code = 'C' then
'We confirm the transaction and call a storedprocedure in SqlServer
else
'if code is different from C, we assume, the transaction status is 'not confirmed' or 'cancelled'
'[PART2: no answer from external webservice]
Else
'so wsReponse is nothing..We don't get any answer from the external webservice
'transaction is not confirmed
'the transaction status is set to 'not confirmed' in database
所以我想做的是,在第2部分中(当没有从外部Web服务获得答案时),在数据库中发送“未确认”状态之前等待30秒。所以我想再做一次第0部分:再次调用外部Web服务至少10次,看看它是否有响应。一种递归过程。
所以我想到了两种方法:
关于我不知道如何让ASP入睡。尤其是当你在一个托管的网站上。所以我要做的是:我会有一个像Pingdom.com这样的服务,每隔10秒请求一个ASP页面。然后,请求的ASP页面将处理任何挂起的事务(记录在选项卡中)。我不知道如何使ASP进入睡眠状态。尤其是当你在一个托管的网站上。所以我要做的是:我会有一个像Pingdom.com这样的服务,每隔10秒请求一个ASP页面。然后,请求的ASP页面将处理任何挂起的事务(记录在选项卡中)。下面是一个简单的子例程,它将根据需要延迟几秒钟
Sub MyDelay(NumberOfSeconds)
Dim DateTimeResume
DateTimeResume= DateAdd("s", NumberOfSeconds, Now())
Do Until (Now() > DateTimeResume)
Loop
End Sub
只需在第2部分中调用这个子程序
Call MyDelay(30)
下面是一个简单的子程序,它将根据需要延迟数秒
Sub MyDelay(NumberOfSeconds)
Dim DateTimeResume
DateTimeResume= DateAdd("s", NumberOfSeconds, Now())
Do Until (Now() > DateTimeResume)
Loop
End Sub
只需在第2部分中调用这个子程序
Call MyDelay(30)
谢谢你的回复,但我不能使用pingdom.com有很多原因。谢谢你的回复,但我不能使用pingdom.com有很多原因。