KestrelServerOptions Class

Definition

Provides programmatic configuration of Kestrel-specific features.

public ref class KestrelServerOptions
public class KestrelServerOptions
type KestrelServerOptions = class
Public Class KestrelServerOptions
Inheritance
KestrelServerOptions

Constructors

KestrelServerOptions()

Properties

AddServerHeader

Gets or sets whether the Server header should be included in each response.

AllowResponseHeaderCompression

Gets or sets a value that controls whether dynamic compression of response headers is allowed. For more information about the security considerations of HPack dynamic header compression, visit https://tools.ietf.org/html/rfc7541#section-7.

AllowSynchronousIO

Gets or sets a value that controls whether synchronous IO is allowed for the Request and Response

ApplicationSchedulingMode

Gets or sets a value that determines how Kestrel should schedule user callbacks.

ApplicationServices

Enables the Listen options callback to resolve and use services registered by the application during startup. Typically initialized by UseKestrel()"/>.

ConfigurationLoader

Provides a configuration source where endpoints will be loaded from on server start. The default is null.

DisableStringReuse

Gets or sets a value that controls whether the string values materialized will be reused across requests; if they match, or if the strings will always be reallocated.

EnableAltSvc

Controls whether to return the AltSvcHeader from on an HTTP/2 or lower response for HTTP/3

Limits

Provides access to request limit options.

RequestHeaderEncodingSelector

Gets or sets a callback that returns the Encoding to decode the value for the specified request header name, or null to use the default UTF8Encoding.

Methods

Configure()

Creates a configuration loader for setting up Kestrel.

Configure(IConfiguration)

Creates a configuration loader for setting up Kestrel that takes an IConfiguration as input. This configuration must be scoped to the configuration section for Kestrel. Call Configure(IConfiguration, Boolean) to enable dynamic endpoint binding updates.

Configure(IConfiguration, Boolean)

Creates a configuration loader for setting up Kestrel that takes an IConfiguration as input. This configuration must be scoped to the configuration section for Kestrel.

ConfigureEndpointDefaults(Action<ListenOptions>)

Specifies a configuration Action to run for each newly created endpoint. Calling this again will replace the prior action.

ConfigureHttpsDefaults(Action<HttpsConnectionAdapterOptions>)

Specifies a configuration Action to run for each newly created https endpoint. Calling this again will replace the prior action.

Listen(EndPoint)

Bind to the given endpoint.

Listen(EndPoint, Action<ListenOptions>)

Bind to the given endpoint. The callback configures endpoint-specific settings.

Listen(IPAddress, Int32)

Bind to given IP address and port.

Listen(IPAddress, Int32, Action<ListenOptions>)

Bind to given IP address and port. The callback configures endpoint-specific settings.

Listen(IPEndPoint)

Bind to the given IP endpoint.

Listen(IPEndPoint, Action<ListenOptions>)

Bind to given IP address and port. The callback configures endpoint-specific settings.

ListenAnyIP(Int32)

Listens on all IPs using IPv6 [::], or IPv4 0.0.0.0 if IPv6 is not supported.

ListenAnyIP(Int32, Action<ListenOptions>)

Listens on all IPs using IPv6 [::], or IPv4 0.0.0.0 if IPv6 is not supported.

ListenHandle(UInt64)

Open a socket file descriptor.

ListenHandle(UInt64, Action<ListenOptions>)

Open a socket file descriptor. The callback configures endpoint-specific settings.

ListenLocalhost(Int32)

Listens on ::1 and 127.0.0.1 with the given port. Requesting a dynamic port by specifying 0 is not supported for this type of endpoint.

ListenLocalhost(Int32, Action<ListenOptions>)

Listens on ::1 and 127.0.0.1 with the given port. Requesting a dynamic port by specifying 0 is not supported for this type of endpoint.

ListenUnixSocket(String)

Bind to given Unix domain socket path.

ListenUnixSocket(String, Action<ListenOptions>)

Bind to given Unix domain socket path. Specify callback to configure endpoint-specific settings.

Extension Methods

UseSystemd(KestrelServerOptions)

Open file descriptor (SD_LISTEN_FDS_START) initialized by systemd socket-based activation logic if available.

UseSystemd(KestrelServerOptions, Action<ListenOptions>)

Open file descriptor (SD_LISTEN_FDS_START) initialized by systemd socket-based activation logic if available. Specify callback to configure endpoint-specific settings.

Applies to