You can use SignalR, but for this it can be a little overpriced. Another option is to configure another controller action that checks if the task is completed. Then, on the client side, you can use jQuery to create ajax requests for this controller action. When the action returns fully, you can show a warning or otherwise refresh the page.
$.ajax({ type: 'GET', url: http://mysite.info/tasks/checkComplete/5, success: function (response) { if (response == 'true') { alert('Task complete'); } } });
Regarding server side events, I don't think this is the case when I will use async / wait. If your task really works for an hour, I got the feeling that you will run into timeout problems, etc. I will have a controller action that is used to run the task, but all it does is put a request to run in the database. Then I will have an external βworkerβ that checks the queries in this database and performs the tasks. When the task is completed, it will update this database record to mark it completed. Then the action of the CheckComplete controller from my example above will check the database to see if the task is really completed.
jdehlin
source share