R
R
Roman Koff2021-04-06 23:14:52
ASP.NET
Roman Koff, 2021-04-06 23:14:52

How to implement long running process with Asp.Net Core WebApi?

There is an Asp.Net Core WebApi service that returns some data from the DB in json format.

There is a special hidden method for importing data from an external service (for example /import/get-data), when accessed, a lengthy operation of importing and parsing external data takes place and the result is placed in the database.
The process is quite long and the browser crashes on a timeout without waiting for the import to complete.

How can you properly organize the launch of such a long process so that it does not hang up the current request, but runs normally in the background, while the user immediately returns a response that the import has started. The user can then learn about the completion of the import from the logs, for example.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
oleg_ods, 2021-04-07
@oleg_ods

Look towards Hosted services .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question