KestrunHost.ConfigureListener method (1 of 5)

Configures a listener for the Kestrun host with the specified port and connection logging option.

public void ConfigureListener(int port, bool useConnectionLogging = false)
parameter description
port The port number to listen on.
useConnectionLogging Specifies whether to enable connection logging.

See Also


KestrunHost.ConfigureListener method (2 of 5)

Configures a listener for the Kestrun host with the specified port, optional IP address, and connection logging.

public void ConfigureListener(int port, IPAddress? ipAddress = null, 
    bool useConnectionLogging = false)
parameter description
port The port number to listen on.
ipAddress The IP address to bind to. If null, binds to any address.
useConnectionLogging Specifies whether to enable connection logging.

See Also


KestrunHost.ConfigureListener method (3 of 5)

Configures a listener for the Kestrun host with the specified port, optional IP address, certificate, protocols, and connection logging.

public KestrunHost ConfigureListener(int port, IPAddress? ipAddress = null, 
    X509Certificate2? x509Certificate = null, HttpProtocols protocols = HttpProtocols.Http1, 
    bool useConnectionLogging = false)
parameter description
port The port number to listen on.
ipAddress The IP address to bind to. If null, binds to any address.
x509Certificate The X509 certificate for HTTPS. If null, HTTPS is not used.
protocols The HTTP protocols to use.
useConnectionLogging Specifies whether to enable connection logging.

Return Value

The current KestrunHost instance.

See Also


KestrunHost.ConfigureListener method (4 of 5)

Configures listeners for the Kestrun host based on the provided absolute URI, resolving the host to IP addresses and binding to each address.

public KestrunHost ConfigureListener(Uri uri, X509Certificate2? x509Certificate = null, 
    HttpProtocols? protocols = default, bool useConnectionLogging = false, 
    AddressFamily[]? families = null)
parameter description
uri The absolute URI to configure the listener for.
x509Certificate The X509 certificate for HTTPS. If null, HTTPS is not used.
protocols The HTTP protocols to use.
useConnectionLogging Specifies whether to enable connection logging.
families Optional array of address families to filter resolved addresses (e.g., IPv4-only).

Return Value

The current KestrunHost instance.

Exceptions

exception condition
ArgumentException Thrown when the provided URI is not absolute.
InvalidOperationException Thrown when no valid IP addresses are resolved.

See Also


KestrunHost.ConfigureListener method (5 of 5)

Configures listeners for the Kestrun host by resolving the specified host name to IP addresses and binding to each address.

public KestrunHost ConfigureListener(string hostName, int port, 
    X509Certificate2? x509Certificate = null, HttpProtocols protocols = HttpProtocols.Http1, 
    bool useConnectionLogging = false, AddressFamily[]? families = null)
parameter description
hostName The host name to resolve and bind to.
port The port number to listen on.
x509Certificate The X509 certificate for HTTPS. If null, HTTPS is not used.
protocols The HTTP protocols to use.
useConnectionLogging Specifies whether to enable connection logging.
families Optional array of address families to filter resolved addresses (e.g., IPv4-only).

Return Value

The current KestrunHost instance.

Exceptions

exception condition
ArgumentException Thrown when the host name is null or whitespace.
InvalidOperationException Thrown when no valid IP addresses are resolved.

See Also