4
In Google Inbox allows the creation of reminders and allows you to postpone them to a certain date and time. The reminder is then taken from the main screen and when this exact date and time comes back there.
Thus, the system agenda a task for a date and time and when this date and time comes it executes what was scheduled.
I thought this would be impossible on the web for the following reason: as I know an application hosted on a web server (whether a website, an API, or something else) only executes something when there is a request. Thus, the application expects a request, when it receives it executes what was requested and again becomes idle.
In this case I quoted from Inbox is not what happens. The scheduled date and time comes and the system performs a task without requiring a request for it. Nor is it saying that you need to client connected because from what I realized I think without any client connected it also makes.
How can I do this kind of thing in an ASP.NET environment? I don’t say with IIS necessarily, because now with ASP.NET 5 the hosting options will increase a lot. Is there a way to have this application feature perform a particular scheduled task without relying on requests? If it exists, how does it work?
You can have a program running on the server that performs the tasks. This program can run based on a period of time or some event. I use 2 solutions for this purpose, the Webjob by Azure and Hangfire. Webjobs allows you to run an executable based on a time or event in Queue or blob. Hangfire is more limited but works great for events triggered by your site (although it works outside of Asp.net as well).
– Leo
@Does Leo Hangfire work smoothly on Azure’s vm ? or is there incompatibility because of webjobs ? I need a background manager, I thought about webjobs, for using Zure, but Hangfire seems more flexible
– Rod
@Rod, I use it for more than 6 months on a website on Zure and it works 100%, never gave any problem. Go without fear :D
– Leo
@Rod, I’ve never used Hangfire, so I can’t tell if everything it offers, Web Jobs also offers. But you have another option too which are cloud services. In them you build N-Tier applications where you can add layers of background processing using the worker roles and layers containing websites or web roles. Do a little research on that, maybe it’ll help you.
– SomeDeveloper