loading...

Discussion on: Get your C# WebAPI controller to keep processing a request after returning 200 OK

Collapse
zoltanhalasz profile image
Zoltan Halasz

I have a similar situation in my webApi. The returned value is an entity , which needs long processing as the SQL query is complex (could take even 10-20 seconds). Is this a viable solution to return a value in the finally branch?

Collapse
deanashton profile image
Dean Ashton Author

Hi Zoltan, sorry for the late reply. Unfortinately I don't think so. This method ha already returned the result by the time you would finish processing. It's really only for things like exporting data to a file or sending a message in a queue for later processing (where the output of the processing is not returned to the caller)

In my case, the processing time for the longrunning task was 1 hour :)