共用方式為


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 中介軟體管線中定義一個點,其中會進行路由決策,且 Endpoint 與 相關聯 HttpContext 。 會在 Microsoft.AspNetCore.Routing.EndpointMiddleware 中介軟體管線中定義執行目前 Endpoint 的點。 和 之間的 Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware 中介軟體可能會觀察或變更 Endpoint 與 相關聯的 HttpContextMicrosoft.AspNetCore.Routing.EndpointMiddleware

適用於