问题
I have a web page on a which does some database updates (e.g. http://www.mysite.com/updates.asp). I want this page to be called automatically each day at 09:00.
I know how to schedule a task in IIS, but the process of scheduling a task requires that I select a programme to operate the task. So I'm thinking perhaps I need to make a .exe file which calls the web page, then schedule that .exe to run daily.
Is this right? If so, how do I create a simple .exe to do this? My skills are solely front end web (html/css) and classic ASP, so I've never done anything like creating a .exe before, but I'm sure it can't be too difficult as it's only doing something very simple i.e. loading a web page.
I've looked online and the only examples I can find are full asp.net examples which contain logging of schedules etc, but I'm looking for something much simpler. I just need to get the web page called once daily.
Alternatively, is there a different way I can get the scheduler to call the page without a .exe?
Many thanks for any pointers...
回答1:
An exe to send an HTTP get request would be simple to create but there are lots around that you can use, for example wget.exe from http://gnuwin32.sourceforge.net/packages/wget.htm
回答2:
To accomplish this using only the Windows Task Scheduler and one line of PowerShell please see this answer
回答3:
I'm looking for an even better way to do this than I'm using right now. Currently I'm using a simple .vbs script to achieve this.
url="http://www.mysite.com/updates.asp"
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Call objHTTP.Open("GET", url, FALSE)
objHTTP.Send
In your scheduled task, call the "wscript.exe" program, and specify the full absolute path to the .vbs file as the argument.
回答4:
This SuperUser.com answer is much simpler.
cmd /c start http://example.com/somePage.html
See my full post, where I comprehensively compare options and justify that the above is simple-as-possible.
- WGET / CURL - good alternative
- PowerShell - not recommended
- VBScript - not recommended
来源:https://stackoverflow.com/questions/3959282/simple-as-possible-task-schedule-to-call-web-page