EndpointRoutingApplicationBuilderExtensions.UseEndpoints 方法

定义

Microsoft.AspNetCore.Routing.EndpointMiddleware使用EndpointDataSource从配置的 IEndpointRouteBuilder生成的实例,将中间件添加到指定的 IApplicationBuilder 。 将 Microsoft.AspNetCore.Routing.EndpointMiddleware 执行与 Endpoint 当前请求关联的 。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseEndpoints(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ builder, Action<Microsoft::AspNetCore::Routing::IEndpointRouteBuilder ^> ^ configure);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseEndpoints (this Microsoft.AspNetCore.Builder.IApplicationBuilder builder, Action<Microsoft.AspNetCore.Routing.IEndpointRouteBuilder> configure);
static member UseEndpoints : Microsoft.AspNetCore.Builder.IApplicationBuilder * Action<Microsoft.AspNetCore.Routing.IEndpointRouteBuilder> -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseEndpoints (builder As IApplicationBuilder, configure As Action(Of IEndpointRouteBuilder)) As IApplicationBuilder

参数

builder
IApplicationBuilder

IApplicationBuilder 向其添加中间件的 。

configure
Action<IEndpointRouteBuilder>

用于配置所提供的 IEndpointRouteBuilderAction<T>

返回

完成操作后对此实例的引用。

注解

对 的UseEndpoints(IApplicationBuilder, Action<IEndpointRouteBuilder>)调用之前必须针对同IApplicationBuilderUseRouting(IApplicationBuilder)实例调用 。

Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware 中间件管道中定义一个点,在其中做出路由决策,并且 EndpointHttpContext相关联。 定义 Microsoft.AspNetCore.Routing.EndpointMiddleware 中间件管道中的一个点,其中执行了当前 Endpoint 。 和 Microsoft.AspNetCore.Routing.EndpointMiddleware 之间的Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware中间件可能会观察到或更改EndpointHttpContext关联的 。

适用于