Reputation: 3100
I'm new to ASP.net,
I am writing a webapi to kick off some heavy server side processing which I need assurance will complete.
At present the ASP.net request kicks off a new Task (Task.Factory.StartNew(...)) then returns a URL the user can poll to find status.
However I am getting the odd ThreadAborted exceptions in the serverside processing tasks and reading this question I am thinking that using Task is not the best option.
Is there a better parallelism/async paradigm for spawning long running server side processes which need assurance of completion ?
Upvotes: 1
Views: 135
Reputation: 16393
IIS can recycle your application at any time so the web server is not the best thing to use for this. Your best bet would be to run a windows service on a separate server and either self host the WebApi in that or use MSMQ to send a message from the web server to the "app" server to initiate the processing.
Upvotes: 1