Thread Sleep in Classic ASP?

后端 未结 12 2102
滥情空心
滥情空心 2021-02-05 23:10

I\'m doing some revision on an old app that is written in classic ASP/VbScript.

It has a feature to send out an e-mail to the members of the application, but because the

相关标签:
12条回答
  • 2021-02-05 23:25

    You know, this is one of those times that I think setting up a private MSMQ queue could be a Good Thing. Put the emails you want to send on the queue, and have a newly developed .NET service do the sending. That will free up your ASP.NET application, and allow you to manage your sendin' centrally!

    0 讨论(0)
  • 2021-02-05 23:29

    there is also a good hta hack that should work. Look for the A Synthetic Sleep Function here: http://www.mvps.org/scripting/rube/index.htm

    0 讨论(0)
  • 2021-02-05 23:32

    Not to my knowledge. You'll have to use some external code written in class VB or whatever to do it.

    Or busy-wait (gak).

    0 讨论(0)
  • 2021-02-05 23:35

    This routine waits any amount of time, and doesn't use CPU:

    Function asp_Wait(nMilliseconds)
      Dim oShell
      '' VBS: Set oShell= Wscript.CreateObject("WScript.Shell")
      '' ASP:
      Set oShell= Server.CreateObject("WScript.Shell")
      Call oShell.run("ping 1.1.1.1 -n 1 -w " & nMilliseconds,1,TRUE) 
      '' Option TRUE: Wait until ping is complete
      '' 1000 milli-second wait is 1 second
    End Function
    
    0 讨论(0)
  • 2021-02-05 23:35

    This looks like a good hack:

    http://www.ehow.com/how_2001270_sleep-asp-using-ado.html

    The trick is to create an ADO connection object and then try to connect to a non-existant server. This will block for the duration of the connection object's timeout setting.

    0 讨论(0)
  • 2021-02-05 23:39

    Be aware that IIS has a default ASP Script execution time-out default of 90 seconds, so running large scripts that send volumes of email this way will time-out unless you change the asp timeout.

    0 讨论(0)
提交回复
热议问题