[release/6.0] Run user defined hosted services before the server starts. (#36133)
* Run user defined hosted services before the server starts. - The generic web hosted service is added before any user code runs, as a result its impossible to write a hosted services that run before server startup. This behavior differs from what happens when you use the Startup class today. We call ConfigureServices then we add the IHostedService implementation that starts the server. This change mimics that behavior by adding the initial set of hosted services after your code runs. - Added a test * Apply suggestions from code review Co-authored-by:Stephen Halter <halter73@gmail.com> Co-authored-by:
David Fowler <davidfowl@gmail.com> Co-authored-by:
Stephen Halter <halter73@gmail.com>
显示
- src/DefaultBuilder/src/WebApplicationBuilder.cs 17 个添加, 0 个删除src/DefaultBuilder/src/WebApplicationBuilder.cs
- src/DefaultBuilder/src/WebApplicationServiceCollection.cs 13 个添加, 6 个删除src/DefaultBuilder/src/WebApplicationServiceCollection.cs
- src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs 61 个添加, 0 个删除...er/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs
加载中
想要评论请 注册 或 登录