Scheduled Tasks on the Web

3

In Google Inbox, you can create reminders and postpone them to a certain date and time. The reminder is then taken from the main screen and when that exact date and time arrives it returns to the.

In this way, the system schedules a task for a date and time and when that date and time arrives it executes what has been scheduled.

I thought this would be impossible on the web for the following reason: so I know an application hosted on a web server (be it a website, an API, or something else) only performs something when there is a request. This way, the application waits for a request, when it receives it it executes what was requested and goes back idle.

In this case I mentioned in Inbox is not what happens. The scheduled date and time arrives and the system performs a task without requiring a request for it. Also it is not saying that you need client connected, because from what I realized I think without any connected client it also does.

How can I do this sort of thing in an ASP.NET environment? I do not even say with IIS necessarily, because now with ASP.NET 5 the hosting options will increase a lot. Is there any way to have this application feature run a certain scheduled task without relying on requests? If it exists, how does it work?

    
asked by anonymous 20.11.2014 / 21:21

1 answer

5

Essentially the same way you would in a non-web task. It's just like what you do on your computer. It can be the Windows task scheduler, cron that exists in Linux and similar distributions, or any other scheduler software. The application running on the server is an application like any other.

Simple solution

I think the ideal is to create a separate application from the rest of the web application itself. In it you put what needs to be run in background at regular times and what only serves what will run on the server. In theory you can use any technology for this. You do not necessarily have to be connected to ASP.Net, even if this is the technology you use in the rest of the solution. So it does not mix with the application that talks directly to the client. In some cases this can give more power avoiding security problems. Imagine that scheduled calling application needs high privilege and is coupled with what the HTTP server runs. Dangerous, is not it?

Ready solutions

Of course, these schedulers need permission to use it. Not all lodging is available.

20.11.2014 / 21:35