During debugging of asp.net core program or after running dotnet command in production environment, an error is reported: Microsoft. Hosting. Lifetime [0] application is shutting down
My reason is that several big brothers wrote several background tasks and inherited the backgroundservice. The code used in the executeasync method is executed synchronously.
In other words, the program must wait for all customized backgroundservices to be executed.
Now that the reason is found, wrap all the code in task.Run() in the executeasync method body.