Kestrel now reacts to configuration changes by default #22807
Labels
affected-very-few
This issue impacts very few customers
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
feature-kestrel
severity-nice-to-have
This label is used by an internal tool
task
Milestone
Kestrel now reacts to configuration changes by default
Kestrel now reacts to changes made to the "Kestrel" section of the application's IConfiguration (e.g. appsettings.json) at runtime. To learn more about how to configure Kestrel using appsettings.json, see the appsettings.json example in https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel#endpoint-configuration.
Kestrel will bind, unbind and rebind endpoints as necessary to react to these configuration changes.
Version introduced
ASP.NET Core 5.0.0-preview7
Old behavior
Prior to 5.0.0-preview6, Kestrel did not support changing config at runtime.
In 5.0.0-preview6, you could opt into the now-default behavior of reacting to configuration changes at runtime by binding Kestrel's configuration manually as follows:
New behavior
Kestrel now reacts to configuration changes at runtime by default.
Reason for change
To support reconfiguring endpoints at runtime without completely restarting the server. Unlike with a full server restart, unchanged endpoints are not unbound even temporarily.
Recommended action
For the majority of scenarios where Kestrel's default configuration section does not change at runtime, this change has no impact and no action is needed.
For scenarios where Kestrel's default configuration section does change at runtime and Kestrel should react to it, this is now the default behavior.
For scenarios where Kestrel's default configuration section changes at runtime and Kestrel should not react to it, you can opt out as follows:
Notes
This does not change the behavior of the
KestrelServerOptions.Configure(IConfiguration)
overload which still defaults to thereloadOnChange: false
behavior.It's also important to make sure the configuration source supports reloading. For Json sources this is done by calling
AddJsonFile(path, reloadOnChange: true)
. This is already done by default for appsettings.json and appsettings.{Environment}.json.Category
ASP.NET
Affected APIs
reloadOnChange: true
by default.This is the discussion issue for the following announcement: aspnet/Announcements#419
Issue metadata
The text was updated successfully, but these errors were encountered: