Update code and docs for generic hosting upcoming changes
See original GitHub issuePull request aspnet/Hosting#1580 includes changes to how hosting works to support a generic host builder on which web host builder is layered. Some of these changes are breaking and we’ll need to adjust docs, examples, and code to support it.
- Adding an
IServiceProviderFactory
as a service no longer works. CallIHostBuilder.UseServiceProviderFactory
instead. This changes the samples and renders theServiceCollectionExtensions.AddAutofac
method obsolete. - You can no longer return an
IServiceProvider
fromStartup.ConfigureServices
. You must use theIServiceProviderFactory
andConfigureContainer
. This will affect the use case where folks intentionally want to keep a reference to the built container or use a child lifetime scope as the pseudo-root of the app. I’ve mentioned that in a comment on the PR. You may need a custom service provider factory for this, but you can capture the factory instance during Configure.
In general it appears that while the new pattern moves toward a more generic hosting mechanism, it moves away from the notion of having composite application types (e.g., a self-hosted ASP.NET Core app and a background service all in one logical process).
Issue Analytics
- State:
- Created 5 years ago
- Comments:25 (20 by maintainers)
Top Results From Across the Web
NET Generic Host
Learn about the .NET Generic Host, which is responsible for app startup and lifetime management.
Read more >Migrate from ASP.NET Core 5.0 to 6.0
Detailed examples of migrating ASP.NET Core 5 Startup code to ASP.NET Core 6 using the minimal hosting model are provided later in this...
Read more >NServiceBus Host Upgrade Version 7 to 8
The NServiceBus Host will be deprecated as of version 9; it is recommended to switch to self-hosting or the generic host for new...
Read more >Latest Google Search Documentation Updates
This page details the latest major updates made to the Google Search Central ... April 20: Added a new generic crawler, GoogleOther ,...
Read more >Releases | GitLab
You can use Generic packages to host your release assets. For a complete example, see the Release assets as Generic packages project.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Docs are adjusted and an RC package just went out. This will be the 5.0.0 release when it’s finalized, but we’ll wait on that final release until after .NET Core 3 itself is released.
I will likely release a beta package shortly. Also, don’t forget there’s a MyGet feed for early adopters where you can pick up and use any of our CI builds:
https://www.myget.org/F/autofac/