aspnet / HttpSysServer

[Archived] A web server for ASP.NET Core based on the Windows Http Server API. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
106 stars 39 forks source link

Add IServiceProvider to HttpSysOptions #388

Closed kdaveid closed 6 years ago

kdaveid commented 7 years ago

In order to configure HttpSys with WebHostBuilder it would help to have access to IServiceProvider within .UseHttpSys(Action<HttpSysOptions> options) extension method. I.e. it would be nice to extract IConfiguration and use app settings from there.

This would be streamlined to Kestrel KestrelServerOptions https://github.com/aspnet/KestrelHttpServer/blob/rel/2.0.0/src/Microsoft.AspNetCore.Server.Kestrel.Core/KestrelServerOptions.cs#L51.

HttpSysOptions: https://github.com/aspnet/HttpSysServer/blob/rel/2.0.0/src/Microsoft.AspNetCore.Server.HttpSys/HttpSysOptions.cs

Tratcher commented 7 years ago

Note this has side effects. Kestrel's approach does not work with some DI containers because it relies on ordering. Capturing your dependencies via closure is more reliable.

kdaveid commented 7 years ago

Yes, I get that. I'm building a webapp that can be started in different ways (servers). I thought it's odd that the configuration are not the same.

Feel free to close it.