Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Generic host: Startup class #1249

Closed
jmezach opened this issue Oct 29, 2017 · 2 comments
Closed

Generic host: Startup class #1249

jmezach opened this issue Oct 29, 2017 · 2 comments
Milestone

Comments

@jmezach
Copy link

jmezach commented Oct 29, 2017

From what I can tell the generic HostBuilder currently does not have the same Startup class pattern that the WebHostBuilder uses. Personally I like the separation of concerns there since with the WebHostBuilder all the logic that deals with the host itself is maintained inside Program.cs, while the Startup class deals only with your app. In the HostBuilder model these concerns are intertwined inside Program.cs.

Was this a deliberate choice, or is it still open for discussion?

@Tratcher
Copy link
Member

Tratcher commented Oct 29, 2017

This is deliberate for two reasons.

  1. Startup is ASP.NET specific, the Configure method builds a http request processing pipeline. It's not clear what a generic version of this would look like.
  2. Startup requires two service containers, one from the host to instantiate it, and a second for the app with the results of ConfigureServices. This dual container model has caused a lot of confusion with the current stack so we want to avoid it in the generic stack.

That said, we're not moving web apps over to the generic host for a while yet and we'll likely need at least some compat shims for Startup when we do migrate. Here's the generic web host prototype:

.ConfigureWebHost((hostContext, app) =>

@muratg muratg added this to the 3.0.0 milestone Nov 7, 2017
@davidfowl
Copy link
Member

See #1163 (the Startup section) This was intentional.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants