EndpointRoutingApplicationBuilderExtensions.UseRouting 方法

定义

将中间 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 向其添加中间件的 。

返回

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

注解

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

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

适用于