Equivalent of Ihostedservice in asp.net framework for background tasks

五迷三道 提交于 2020-06-24 06:27:33

问题


I have a restful micro service (web api) in .net 4.6.2 and I want to call a fire and forget function each time after certain endpoints are called to do some database cleanup work. I don' want to use Task.Run and I want to have a much reliable dedicated process to do this job.

I found lot's of articles and discussions about how to use IhostedService in .net core for long running background tasks.

https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/multi-container-microservice-net-applications/background-tasks-with-ihostedservice

https://thinkrethink.net/2018/02/21/asp-net-core-background-processing/

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-2.1

However I didn't find much information about the equivalent in .net framework. Is that IRegisteredObject? Can somebody please help me or direct me to the right resources.

Notes: We host the API as a windows service and don't use IIS

This is the first time I am asking a question here, therefore apologies if the question is not claer enough.

来源:https://stackoverflow.com/questions/51390284/equivalent-of-ihostedservice-in-asp-net-framework-for-background-tasks

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