6

I need to run some tasks in Asp.net MVC, after every 5 minutes. I've never worked on such functionality. So i googled it and got some options to implement this functionality. These are the options here, here and here

I've looked over the above links. These all just confuse the person to choose best process to run background process.

I'm new on such functionality, that's why I'm here to discuss/ask the several ways available to implement it.

Code Rider
  • 2,003
  • 5
  • 32
  • 50
  • You can also use a hosted service for this. https://azure.microsoft.com/en-us/services/scheduler/ – live2 May 29 '17 at 05:35

1 Answers1

8

You can use Hangfire It's a fantastic framework for background jobs in ASP.NET.You can find HangFie Tutorial Here.

The best feature from Hangfire is its built in /hangfire dashboard that shows you all your scheduled, processing, succeeded and failed jobs. It's really a nice polished addition.

All these libraries are excellent, are open source, and Available as Nuget Packages.

enter image description here

Some Other Options

QUARTZ.NET

FLUENTSCHEDULER

WEBBACKGROUNDER

Curiousdev
  • 5,668
  • 3
  • 24
  • 38
  • I was confused in only two options and you have given me more.. thanks btw. – Code Rider May 29 '17 at 06:38
  • 1
    @CodeRider I would recommend hangfire please take a look it'll definitely help you – Curiousdev May 29 '17 at 07:02
  • I've a question that if no one will hit site url for one week, would this job keep running in back-end or it needs to hit the url to start some event. – Code Rider May 29 '17 at 08:08
  • No that doesn't not matter if someone visit site or not this job'll start on webserver and keep running until your webserver(IIS) stopped. and maje it running always please read a good Doc [Here](http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html) – Curiousdev May 29 '17 at 08:27
  • Phil Haack wrote a great article on the dangers of recurring background tasks in ASP.NET http://haacked.com/archive/2011/10/16/the-dangers-of-implementing-recurring-background-tasks-in-asp-net.aspx/ Hanselman options: https://www.hanselman.com/blog/HowToRunBackgroundTasksInASPNET.aspx – PreguntonCojoneroCabrón Mar 10 '18 at 09:35