WEBAPI + Windows Plan + Mshta implement scheduled Tasks

Source: Internet
Author: User

Of course, there are better ways to implement timed tasks, such as
Way One:
ASP. Mvc+quartz.net +corn +webapi,asp.net MVC to do task management platform, use Crontrigger to do timing trigger, quartz.net do timing execution control, WEBAPI implement execution logic
Way two:
A cliché, Windows service (boot) + timer (timer,quartz.net, etc.) +webapi (or other implementation logic)
Recently in doing Cs,timer implementation time control is not accurate, decided to implement the Windows plan, first introduce the Mshta bar:

Mshta
It supports command line parameters and can receive JS and VBS methods.
Examples are as follows:

// JS, to start with VBScript: implementation does not open the browser display Hello world! Mshta vbscript:window.execScript ("alert (' Hello world! ');", "JavaScript") (window.close)// VBA, to start with javascript: implementation does not open the form display Hello world! 

WebApi

Create a WEBAPI, assuming the path is http://localhost:22673/api/SendMail/SendToLeader, need support HttpGet

Then, when rebuilding the Windows execution plan, in the action-select startup program, you can refer to the following:

// cmd command, you can implement logical control by executing the following statement without opening the browser // using Mshta directly as a program file can // creating a BAT file as a program file can also be mshta vbscript:createobject ("Wscript.Shell"). Run ("" "" IExplore "" http://localhost:22673/ Api/sendmail/sendtoleader ", 0) (Window.close)

WEBAPI + Windows Plan + Mshta implement scheduled Tasks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.