- 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 BackgroundService, a base class for long running HostedServices
- Today the IHostedService pattern is a StartAsync/StopAsync pattern. Neither of these
methods are supposed to return a long running task that represents an execution. If
you wanted to have some logic run on a timer every 5 minutes, it's unnatural to do so
with simple async idioms. This base class implements IHostedService and exposes
a pattern where a long running async Task can be returned.
- The token passed into ExecuteAsync represents the lifetime of the execution.
- StartAsync and StopAsync were made virtual to allow the derived type to
indicate Start failures.
- Added tests
- Remove IStartupLoader and add `IStartup` instead that matches the signature hosting cares about
- Moved `UseStartup` to extension methods
- Move existing logic into `ConventionBasedStartup` class
- aspnet/Coherence-Signed#187
- remove `<RootNamespace>` settings but maintain other unique aspects e.g. `<DnxInvisibleContent ... />`
- in a few cases, standardize on VS version `14.0` and not something more specific
- Added IWebApplicationBuilder and moved it to Hosting.Abstractions as a
target for others to extend the web application builder.
- Made methods extension methods where possible
- Added UseUrls