Quartz.net Regular SMS and email (2.30 version)

Source: Internet
Author: User

Official download of the Quartz.net package area. The decompression needs to be in the bin inside the "Quartz.dll" "Common.Logging.Core.dll" "Common.Logging.dll" the three class library, and then add these three class libraries to their own project Bin folder and then reference. Then add <add key= "cronexpr" value= "0 54 16 * *" in the Web. config appsetting configuration file The value of/> is when you want to schedule the time I set is four o'clock in the afternoon 54 minutes per day. The Application_Start () in the Global.asax file is then written in the Application_End method: the following code;

 Public voidApplication_Start () {//read the task start time from the configuration file            stringcronexpr = configurationmanager.appsettings["cronexpr"]; //Create a schedulerIschedulerfactory sfactory =NewStdschedulerfactory ();//PerformerIScheduler Scheduler =Sfactory.getscheduler (); //Create a taskIjobdetail job = jobbuilder.create<checkdomainjob> (). Withidentity ("Job1","group1").            Build (); //create a trigger for a task to runItrigger trigger =triggerbuilder.create (). Withidentity ("Triggger1","group1")                . Withschedule (Cronschedulebuilder.cronschedule (Newcronexpression (cronexpr))) .            Build (); //Start a taskScheduler.            Schedulejob (Job, trigger); Scheduler.        Start (); }

 Public void application_end ()        {            // Close Scheduler            at end of program if NULL )            {                Scheduler. Shutdown (true);     }}}

Then write an inherited Ijob class:

 Public class Checkdomainjob:ijob    {        publicvoid  Execute (ijobexecutioncontext context)        {            new Senddoamininfor (); // the object            to be executed by itself Sdi.sendendinfor (); // the way to do it yourself         }          }

Complete.

Quartz.net Regular SMS and email (2.30 version)

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.