EndpointRoutingApplicationBuilderExtensions.UseEndpoints 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
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>
用于配置所提供的 IEndpointRouteBuilder 的 Action<T>。
返回
完成操作后对此实例的引用。
注解
对 的UseEndpoints(IApplicationBuilder, Action<IEndpointRouteBuilder>)调用之前必须针对同IApplicationBuilder一UseRouting(IApplicationBuilder)实例调用 。
在 Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware 中间件管道中定义一个点,在其中做出路由决策,并且 Endpoint 与 HttpContext相关联。 定义 Microsoft.AspNetCore.Routing.EndpointMiddleware 中间件管道中的一个点,其中执行了当前 Endpoint 。 和 Microsoft.AspNetCore.Routing.EndpointMiddleware 之间的Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware中间件可能会观察到或更改Endpoint与 HttpContext关联的 。