Asp.Net Core 2.0: Simple way to execute long running tasks and report progress?

喜欢而已 提交于 2019-12-08 05:20:48

问题


I have a page where the user can select multiple files and upload them.

Once the files are buffered in the server, they are deserialized, and the object graphs are stored using Entity Framework Core 2 and SQL Server.

All this happens within a controller action.

The problem is that when the file is a little bit bigger, this collection of tasks can take about 5 minutes to complete, and because of that, I get a 502 error (probably a timeout).

To solve this problem, I had the idea of reporting progress. So it would prevent the timeout. I researched, and some people suggested using SignalR. But I've found out that SignalR is not yet available for Asp.Net Core.

So how can I solve this issue in a basic way? I would like to report progress from my controller action. But if this is complicated stuff to do, then how can I prevent the timeout from happening?

I am using Angular 4.3.5 by the way.

来源:https://stackoverflow.com/questions/45950588/asp-net-core-2-0-simple-way-to-execute-long-running-tasks-and-report-progress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!