-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Preload default Kestrel config before running Kestrel's configureOptions callback #28120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We used to load the dev cert first but that was changed by aspnet/KestrelHttpServer#2465 due to the reasons outlined in aspnet/KestrelHttpServer#2422 (startup perf, log noise even when not using the cert). There may be a middle ground we can reach without regressing those scenarios. |
Startup performance is also a focus on .NET 6 so we want to do what we can to find that middleground and not regress performance here. |
Thanks for contacting us. |
Triage note: The dev cert already works in this scenario. This is about the default cert defined in config. |
Thanks for contacting us. We're moving this issue to the |
...as a way to retrieve the server certificate eagerly (assuming the configuration has been loaded), rather than having to wait until bind-time. Fixes dotnet#28120
...as a way to determine whether a certificate is available before invoking `KestrelServerOptions.Listen` and possibly failing in `ListenOptions.UseHttps`. Fixes dotnet#28120
This issue is inspired by an email from @wiktork. From the email:
The workaround I provided in the email thread was as follows:
While I expect this workaround of manually loading config at the start of the ConfigureKestrel callback works, it's not at all obvious that this should be necessary and is an overall bad experience.
If we instead preload default Kestrel config before running configureKestrel's callback should allow the KestrelServerOptions.Listen() and ListenOptions.UseHttps() methods to pick up "Default"/"Development" certificates and "EndpointDefaults" from config. Since ConfigureWebDefaults is responsible for binding the KestrelConfigurationLoader the the "Kestrel" subsection of config here, this is also where we should do the preloading.
This is a behavioral breaking change, but maybe we can make this less risky by loading just the defaults, and not the endpoints before ConfigureKestrel's callback is run.
The text was updated successfully, but these errors were encountered: