简体   繁体   中英

Scheduling tasks for multiple asp.net projects

What would be the best way in implementing a task scheduler that would run jobs across multiple asp.net projects?

What I mean by that is for example I have one project (Project A) that sends out files to sftp servers and another project (Project B) that sends out Emails to clients. Both need to be automated. What would be the best way of doing that?

I've been researching and found out that if I have access to installing a windows service (I do), then I should do that. But how? Do I create an IJobsInterface in a shared project (Project Shared) and share this amongst A and B, have each project implement their own version of RunJob() and then refer all of these to the windows service (maybe a console app?) and execute RunJob per implementation? Am I even close to a solution?

Take a look at Revalee . It's an open source project that let's you schedule web callbacks to ASP.NET projects. Each ASP.NET application would use the Revalee.Client library to schedule callbacks (with the Revalee Server) to your various web applications; each callback would be the "trigger" for a specific scheduled task. More specifically, each client would register future callbacks with the Revalee Server (ie, a separate Windows Service application which would run once).

Scheduling a callback would be as easy as:

DateTimeOffset callbackTime = new DateTimeOffset(...); // scheduled task trigger time
Uri callbackUrl = new Uri(...); // url to callback (your "job" code resides at this url)
RevaleeRegistrar.ScheduleCallback(callbackTime, callbackUrl);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM