Want to set up some kind of cron equivalent on my IIS server

I am currently working on system customization for my company, using the classic ASP to configure IIS, which relies on third-party API data. The problem is that the API is extremely slow, and all it sends is a large XML file or all the data. Simply correct the request once a day and configure the database to store this information and use the application as a source instead of the API.

I wrote the database placeholder code in an ASP file and just have to make sure it runs every day. What is the best way to do this? I am not very well versed in best practices here, should I have scheduled tasks open by iexplorer pointing to the url that starts the scraper, or is there some way to do this via the command line. I was mostly worried about what I'm trying to translate how to do this in PHP to LAMP for ASP / WISA, instead of treating this as my problem.

+4
source share
4 answers

The cron equivalent on a Windows computer is Scheduled Tasks. A practical guide for Windows XP is here: http://support.microsoft.com/kb/308569 . Similar steps can be performed on most versions of windows.

If you put the data filtering code in an asp file, you can make an http request to this file using the following VBS script:

Const WinHttpVersion = "5.1" Dim objWinHttp, strURL ' Request URL from 1st Command Line Argument. This is ' a nice option so you can use the same file to ' schedule any number of differnet scripts. strURL = WScript.Arguments(0) ' For more WinHTTP v5.0 info, go to Registry Editor to find out ' the version of WinHttpRequest object. Set objWinHttp = CreateObject("WinHttp.WinHttpRequest." & WinHttpVersion) If IsObject(objWinHttp) Then objWinHttp.Open "GET", strURL objWinHttp.Send If objWinHttp.Status <> 200 Then Err.Raise 1, "HttpRequester", objWinHttp.ResponseText End If Set objWinHttp = Nothing End If If Err.Number <> 0 Then ' Something has gone wrong... do something about it... End If 

A call to this would look something like this:

 HttpRequester.vbs http://localhost/MyApp/loadData.asp 
+3
source

I would recommend not using a script to accomplish this. This is best done using the .Net console application called from the task scheduler.

+2
source

You might want to create a Windows service that will run in the background — it's hard to do this only with an ASP page.

+1
source

It is trivial to call an ASP page on a schedule. Just use the Windows port wget or curl (you can use IE if you need) and set up a scheduled task to load the page at the right interval.

No scripts are needed for this, just enter the executable path as the process you want to start, and the URL in the parameters field (plus some other keys, depending on which program you are ending up with).

0
source

All Articles