EndpointRoutingApplicationBuilderExtensions.UseRouting(IApplicationBuilder) 方法

定义

Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware 中间件添加到指定的 IApplicationBuilder

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseRouting(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ builder);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseRouting (this Microsoft.AspNetCore.Builder.IApplicationBuilder builder);
static member UseRouting : Microsoft.AspNetCore.Builder.IApplicationBuilder -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseRouting (builder As IApplicationBuilder) As IApplicationBuilder

参数

builder
IApplicationBuilder

IApplicationBuilder 添加中间件的 。

返回

IApplicationBuilder

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

注解

对 的 UseRouting(IApplicationBuilder) 调用后,必须对同一实例 UseEndpoints(IApplicationBuilder, Action<IEndpointRouteBuilder>) 调用 IApplicationBuilder

定义中间件管道中做出路由决策的点,并且 Microsoft.AspNetCore.Routing.EndpointRoutingMiddlewareEndpoint 相关联 HttpContextMicrosoft.AspNetCore.Routing.EndpointMiddleware定义中间件管道中执行当前 的 Endpoint 点。 和 之间的 Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware 中间 Microsoft.AspNetCore.Routing.EndpointMiddleware 件可能会观察或更改与 Endpoint 关联的 HttpContext

适用于