At this time, developers should use the Web Host based on IWebHostBuilder for hosting ASP.NET Core apps.
Now that ASP.NET Core 2.1 has been released is Generic Host recommended over Web Host for non-web apps?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for commenting. When we wrote "at this time," we actually meant to include the 2.1 release. I asked @DamianEdwards (Community Standup 6/5/18 33:20) about this, and he said that the Generic Host probably won't replace the Web Host until 3.0.
@Tratcher We could modify our sentence about this and make it more specific. Today, it reads ...
The Generic Host will eventually replace the Web Host.
We could go with ...
The Generic Host will eventually replace the Web Host, probably with the release of ASP.NET Core 3.0.
Thanks for the clarification about Generic Host replacing Web Host @guardrex
However, I'm still a little unsure about the guidance on using Generic Host in 2.1 specifically for non-web/HTTP related apps .
At this time, developers should use the Web Host based on IWebHostBuilder for hosting ASP.NET Core apps.
Is this guidance still valid now that 2.1 is released?
If so, when should Generic Host be used? Does it mean that Generic Host should not be used until 3.0+?
If so, why? Is Generic Host not considered prod-ready until 3.0+, even for non-web/HTTP apps?
Yes, you should be able to use it for non-web apps.
I'll defer to @Tratcher and @davidfowl to let us know if we need to be more specific than the current language on that point.
Thus far, here's the proposed revision that includes a mention of when the Generic Host might take over (the end of the last line) ...
Generic Host (ASP.NET Core 2.1 or later) – Suitable today for hosting non-web apps (for example, apps that run background tasks). In a future release, the Generic Host will be suitable for hosting any kind of app, including web apps. The Generic Host will eventually replace the Web Host, probably with the release of ASP.NET Core 3.0.
[EDIT] Let's consider adding the word "today" in the first sentence, too. :point_up:
... and let's add the word "web" to this line ...
At this time, developers should use the Web Host based on IWebHostBuilder for hosting ASP.NET Core web apps.
@DamianEdwards, you don't want to commit to a specific version for this, correct?
I wouldn't mention it at all in docs. It's not committed. WebHost is for web apps, generic host is for other apps. That's it.
Let me clarify what @DamianEdwards means:
You can run background tasks inside of either but you cannot host a webserver inside of the GenericHost (unless you wrote something custom).
I got u. The PR covers your three points. I think we're good, but you might want to eyeball it just to make sure :point_right: #6922
Most helpful comment
Let me clarify what @DamianEdwards means:
You can run background tasks inside of either but you cannot host a webserver inside of the GenericHost (unless you wrote something custom).