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)