I wanna create a notification system on my website?(something like stack-overflow)
How can we schedule a task for mailing the notification for users on each 24 hours?
You need a .Net Job Scheduler. Here is a good one: http://quartznet.sourceforge.net/
There is also a built-in option, QueueBackgroundWorkItem. It was added in .Net 4.5.2 and here is a guide on how to use it in MVC.
In addition to previously mentioned FluentScheduler you also have HangFire. And if you plan on deploying to Azure there's a handful of different services for this.
maybe you wanna use a scheduled task. Doing this in a MVC is a bad idea (mixing responsabilities) and building a windows service looks like an overkill to me (because is something doesn't need to run all the time).
I use scheduled task of windows.
I have build a little app than enter a record in the bd, then access the website with this recordId(Guid) as a parameter.
In mvc i check if the id exist, if it exist i run tasks then delete the record in the db, if not i ignore it.
this way im able to add schedule with a param. without updating the app each time i need a new scheduled task. i just add a new task like "myapp.exe /MyNewTaskName"
hope this help someone ;-)
You can use ATrigger scheduling service. A .Net library is also available to create scheduled tasks without overhead. Errors log, Analytics, Tasks Listings and more benefits.
Disclaimer: I was among the ATrigger team. It's a freeware and I have not any commercial purpose.
Found this to be an awesome scheduler, FluentScheduler
Usage:
// Schedule an ITask to run at an interval
Schedule<MyTask>().ToRunNow().AndEvery(2).Seconds();