- This adds an implementation of IWebHostBuilder as a facade over the IHostBuilder.
This removes the 2 container issue by executing the Startup.ConfigureServies and Startup.ConfigureContainer inline as part of building the IHostBuilder.
- The implementation is highly compatible implementation since it exposes the same IWebHostBuilder interface.
Existing extensions mostly work.
- There are some caveats with this approach.
- Injecting services into Startup is not extremely constrained to the
services availble on HostBuilderContext. This includes the IHostingEnvironment
and the IConfiguration.
- IStartup is broken when using this pattern because it isn't composable.
- The IStartupConfigureServicesFilter and IStartupConfigureContainer The before
and after filters added in 2.1 are also broken because there's a single container (it could maybe be fixed by downcasting and doing something specific on the GenericHostBuilder instance).
- Calling into IWebHostBuilder.Build will throw a NotSupportedException since
this implementation is just a facade over the IHostBuilder.
* Add support for executing IHostingStartup in specified assemblies
- Assemblies that are specified in the "hostingStartupAssemblies" configuration (; delimited)
setting can specify assemblies that use an assembly level attribute (HostingStartupAttribute)
to specify a type that implements IHostingStartup. This allows hosting environments to
extend the IWebHostBuilder with platform specific behavior before the application runs.
- Added tests
- Log errors that occur during load and execution of the IHostingStartup
when capture startup errors is off. This happens on start of the application.
- Added debug logging on startup to print out the hosted startup assemblies hosting
processed
#951