Skip to content

Inconsistent IHostedService ordering between WebHost and Host #11437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tratcher opened this issue Jun 21, 2019 · 5 comments
Closed

Inconsistent IHostedService ordering between WebHost and Host #11437

Tratcher opened this issue Jun 21, 2019 · 5 comments
Assignees
Labels
area-hosting Includes Hosting area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions breaking-change This issue / pr will introduce a breaking change, when resolved / merged. Done This issue has been fixed

Comments

@Tratcher
Copy link
Member

In WebHost IHostedServices run after IServer. We've had a lot of complaints about that and we're considering reversing that in 3.0 to be more consistent with generic Host where they run in registration order.

In generic Host IServer is part of an IHostedService GenericWebHostService and gets registered before any IHostedServices from Startup, the user doesn't get to control that. They can only control the ordering of services registered directly with the Host in Program.

Proposal: delay registering GenericWebHostService until after the app is done registering.

https://github.com/aspnet/AspNetCore/blob/56ffc6b58210292a18f548bf4eddff193f73a4d6/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs#L78
https://github.com/aspnet/AspNetCore/blob/56ffc6b58210292a18f548bf4eddff193f73a4d6/src/Hosting/Hosting/src/GenericHostWebHostBuilderExtensions.cs#L11-L13

@davidfowl

@davidfowl
Copy link
Member

Sounds good to me. So this only affects things in Startup? That sounds like a good change.

@Tratcher
Copy link
Member Author

Tratcher commented Jun 21, 2019

So this only affects things in Startup?

Primarily. It also affects calls to IWebHostBuilder.ConfigureServices in the ConfigureWebHost lambda.

@Tratcher Tratcher self-assigned this Jun 21, 2019
@davidfowl
Copy link
Member

Sounds good

@davidfowl
Copy link
Member

When do we want to do this change? Preview8 or 7?

cc @anurse

@davidfowl davidfowl added the breaking-change This issue / pr will introduce a breaking change, when resolved / merged. label Jun 25, 2019
@analogrelay
Copy link
Contributor

If it's simple (looks like it would be) I'd prefer to cram this in to preview7. @Tratcher, we can sync today on prioritization if necessary.

@analogrelay analogrelay added this to the 3.0.0-preview7 milestone Jun 25, 2019
@Tratcher Tratcher added the Done This issue has been fixed label Jun 26, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
@amcasey amcasey added the area-hosting Includes Hosting label Jun 1, 2023
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-hosting Includes Hosting area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions breaking-change This issue / pr will introduce a breaking change, when resolved / merged. Done This issue has been fixed
Projects
None yet
Development

No branches or pull requests

5 participants