I was reading into using Quartz http://quartznet.sourceforge.net/tutorial/lesson_3.html but I don’t understand how to implement. I was also reading this https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/, also don’t understand how to implement, specifically, where do I put it and how do I access my controllers/actions?
There is a comment on the article linked above that suggests to use, "… a simple timer in global.asax." How can this be achieved?
Basically, I would like to know how (and what’s the best way) to schedule the following action on the following controller?
Public Class RssController
Inherits System.Web.Mvc.Controller
Function InsertRssFeedItem(ByVal url as String) As ActionResult
' code to get RSS and insert into database '
End Function
End Class
I generally consider it bad practice to have a web server doing automation, I prefer that to be kept away in a service that is more suited to automated jobs.
That said, using the above artice, I would put the section titled using Quartz.net into the application_start in global.asax
In the application_end, shut down the job scheduler.
Finally, in a folder, write a class like:
c#
vb.net
Sorry, I don’t know VB that well to write it outside of an IDE, so you will need to convert this c#.Also, if the RssController needs access to any context information, you will need to get that from the HttpContext class.
Si