Support re-using GenericWebHostBuilder and GenericWebHostService
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Problem statement
I'm trying to help on this issue: https://github.com/microsoft/service-fabric-aspnetcore/issues/48
in addition to private integration of ASP.NET Core 3.0 + kestrel hosting within Service Fabric. Consider a basic kestrel web server, exposing http and https endpoints, within a SF node.
We'd like to add support for using a generic host within Service Fabric ASP.NET Core 3.0 apps. The advantages of using a generic host are:
* Use a single configuration instance, DI container, and web pipeline across multiple SF endpoints (eg 1 endpoint for http, 1 endpoint for https, perhaps another for gRPC) in a host
* WebHostBuilder is deprecated, so we want to avoid investing in that if possible
The current ASP.NET Core hosting model within SF is mostly dictated by this project:
https://github.com/microsoft/service-fabric-aspnetcore
Which is documented here:
https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-aspnetcore
If you follow the documentation literally (see https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-aspnetcore#kestrel-in-reliable-services), you end up with separate kestrel pipelines, DI containers, etc per endpoint. It's possible to work around this, but it's not trivial and many developers struggle with it, per Stack Overflow.
In order to implement a better, generic host-based hosting model for Service Fabric, it would be great to be able to re-use much of `GenericWebHostBuilder` and `GenericWebHostService` without copying + maintaining all the classes. Also note that `ISupportsStartup` and `ISupportsUseDefaultServiceProvider` are internal, so they can't be implemented.
### Describe the solution you'd like
I'd like to see a separation + make public of the portions of GenericWebHost that should be re-used in scenarios like this.
If it's helpful I can provide an implementation of a ServiceFabric host builder, with details on what the sticking points are.
Contributor guide
Assessment
This issue has not been assessed yet.