In VS 2013, I'm using EF6 and MVC 5. I want to set up a long-running process to execute in the background and then return quickly to the web controller because it is resulting in timeout errors. An SQL server database will get updates from the background task. In essence, I require a. blaze and forget functionality. There seem to be several choices:
async- This doesn't seem like a very safe choice.
Since option 3 keeps all the code in one solution, it would be preferred. Could you please discuss the advantages and disadvantages of each and, if feasible, provide practical examples of number 3?
The long-running process could be stopped, for example, if the application pool recycles, according to HostingEnvironment.QueueBackgroundWorkItem, which is a valid solution.
Running it as a scheduled process, for instance using Quartz.NET, would be a preferable choice.