语言

ListenOptions 类

定义

描述 Kestrel 应绑定到或打开的已打开套接字的 IPEndPoint、Unix 域套接字路径、命名管道名称或文件描述符。

public ref class ListenOptions : Microsoft::AspNetCore::Server::Kestrel::Transport::Abstractions::Internal::IEndPointInformation
public ref class ListenOptions : Microsoft::AspNetCore::Connections::IConnectionBuilder, Microsoft::AspNetCore::Server::Kestrel::Transport::Abstractions::Internal::IEndPointInformation
public ref class ListenOptions : Microsoft::AspNetCore::Connections::IConnectionBuilder
public class ListenOptions : Microsoft.AspNetCore.Connections.IConnectionBuilder, Microsoft.AspNetCore.Connections.IMultiplexedConnectionBuilder
public class ListenOptions : Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal.IEndPointInformation
public class ListenOptions : Microsoft.AspNetCore.Connections.IConnectionBuilder, Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal.IEndPointInformation
public class ListenOptions : Microsoft.AspNetCore.Connections.IConnectionBuilder
type ListenOptions = class
    interface IConnectionBuilder
    interface IMultiplexedConnectionBuilder
type ListenOptions = class
    interface IEndPointInformation
type ListenOptions = class
    interface IEndPointInformation
    interface IConnectionBuilder
type ListenOptions = class
    interface IConnectionBuilder
Public Class ListenOptions
Implements IConnectionBuilder, IMultiplexedConnectionBuilder
Public Class ListenOptions
Implements IEndPointInformation
Public Class ListenOptions
Implements IConnectionBuilder, IEndPointInformation
Public Class ListenOptions
Implements IConnectionBuilder
继承
ListenOptions
实现
IConnectionBuilder IMultiplexedConnectionBuilder Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal.IEndPointInformation

属性

名称 说明
ApplicationServices

获取应用程序 IServiceProvider。

ConnectionAdapters

List<T>获取允许截获和转换每个连接Stream。 由 UseHttps() 扩展方法配置 UseConnectionLogging(ListenOptions) 。

DisableAltSvcHeader

获取或设置一个值,该值控制响应标头中是否包含“Alt-Svc”标头。 客户端使用“Alt-Svc”标头将 HTTP/1.1 和 HTTP/2 连接升级到 HTTP/3。

如果 Protocols 启用了 HTTP/1.1 或 HTTP/2,并且启用了 HTTP/3,则“Alt-Svc”标头会自动包含在响应中。 如果应用已设置“Alt-Svc”标头值,则不会更改它。

EndPoint

获取 EndPoint。

FileHandle

获取套接字的绑定文件描述符。

HandleType

描述 Kestrel 应绑定到或打开的已打开套接字的 IPEndPoint、Unix 域套接字路径、命名管道名称或文件描述符。

IPEndPoint

获取绑定 IPEndPoint。

KestrelServerOptions

获取 KestrelServerOptions 侦听器选项。 使连接中间件能够解析和使用应用程序在启动期间注册的服务。

NoDelay

设置为 false,为所有连接启用 Nagle 算法。

PipeName

获取名称管道服务器的绑定管道名称。

Protocols

在此终结点上启用的协议。

SocketPath

获取 Unix 域套接字的绑定绝对路径。

Type

所描述的接口类型: IPEndPointUnix 域套接字路径或文件描述符。

方法

名称 说明
Build()

ConnectionDelegate生成 .

Clone(IPAddress)

用于克隆到两个 IPEndpoints

ToString()

描述 Kestrel 应绑定到或打开的已打开套接字的 IPEndPoint、Unix 域套接字路径、命名管道名称或文件描述符。

Use(Func<ConnectionDelegate,ConnectionDelegate>)

将中间件委托添加到连接管道。 由 UseHttps() 扩展方法配置 UseConnectionLogging(ListenOptions) 。

显式接口实现

名称 说明
IMultiplexedConnectionBuilder.Build()

描述 Kestrel 应绑定到或打开的已打开套接字的 IPEndPoint、Unix 域套接字路径、命名管道名称或文件描述符。

IMultiplexedConnectionBuilder.Use(Func<MultiplexedConnectionDelegate,MultiplexedConnectionDelegate>)

描述 Kestrel 应绑定到或打开的已打开套接字的 IPEndPoint、Unix 域套接字路径、命名管道名称或文件描述符。

扩展方法

名称 说明
Run(IConnectionBuilder, Func<ConnectionContext,Task>)

将给定 middleware 内容添加到连接。

Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>)

将给定 middleware 内容添加到连接。 如果不调用下一个函数,请改用 Run(IConnectionBuilder, Func<ConnectionContext,Task>) 。

Use(IConnectionBuilder, Func<ConnectionContext,Func<Task>,Task>)

将给定 middleware 内容添加到连接。 如果不调用下一个函数,请改用 Run(IConnectionBuilder, Func<ConnectionContext,Task>) 。

首选使用 Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>) 以提高性能,如下所示:

builder.Use((context, next) =>
{
    return next(context);
});

UseConnectionHandler<TConnectionHandler>(IConnectionBuilder)

使用给定 TConnectionHandlerConnectionHandler的 。

UseConnectionLogging(ListenOptions, String)

发出从连接读取和写入的字节的详细日志。

UseConnectionLogging(ListenOptions)

发出从连接读取和写入的字节的详细日志。

UseConnectionTimeout(ListenOptions)

添加连接超时中间件。

UseHttps(ListenOptions, Action<HttpsConnectionAdapterOptions>)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions, HttpsConnectionAdapterOptions)

将 Kestrel 配置为使用 HTTPS。 这不使用通过配置 ConfigureHttpsDefaults(Action<HttpsConnectionAdapterOptions>)或指定的默认证书或其他默认值。

UseHttps(ListenOptions, ServerOptionsSelectionCallback, Object, TimeSpan)

将 Kestrel 配置为使用 HTTPS。 这不使用通过配置 ConfigureHttpsDefaults(Action<HttpsConnectionAdapterOptions>)或指定的默认证书或其他默认值。

UseHttps(ListenOptions, ServerOptionsSelectionCallback, Object)

将 Kestrel 配置为使用 HTTPS。 这不使用通过配置 ConfigureHttpsDefaults(Action<HttpsConnectionAdapterOptions>)或指定的默认证书或其他默认值。

UseHttps(ListenOptions, StoreName, String, Boolean, StoreLocation, Action<HttpsConnectionAdapterOptions>)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions, StoreName, String, Boolean, StoreLocation)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions, StoreName, String, Boolean)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions, StoreName, String)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions, String, String, Action<HttpsConnectionAdapterOptions>)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions, String, String)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions, String)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions, TlsHandshakeCallbackOptions)

将 Kestrel 配置为使用 HTTPS。 这不使用通过配置 ConfigureHttpsDefaults(Action<HttpsConnectionAdapterOptions>)或指定的默认证书或其他默认值。

UseHttps(ListenOptions, X509Certificate2, Action<HttpsConnectionAdapterOptions>)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions, X509Certificate2)

将 Kestrel 配置为使用 HTTPS。

UseHttps(ListenOptions)

将 Kestrel 配置为将 HTTPS 与默认证书配合使用(如果可用)。 如果未配置默认证书,则会引发此错误。

UseHub<THub>(IConnectionBuilder)

配置连接以托管指定 Hub 类型。

UseTlsClientHelloListener(ListenOptions, Action<ConnectionContext,ReadOnlySequence<Byte>>, Nullable<TimeSpan>)

添加一个连接中间件,该中间件会探查 TLS Client Hello 消息,并在执行 TLS 握手之前使用原始字节调用 tlsClientHelloBytesCallback 。 必须先 UseHttps() 调用此函数,使中间件在 TLS 握手之前运行。

适用于