共用方式為


EndpointRoutingApplicationBuilderExtensions.UseEndpoints 方法

定義

Microsoft.AspNetCore.Routing.EndpointMiddleware將中介軟體新增至指定的 IApplicationBuilder ,其中包含從設定 IEndpointRouteBuilderEndpointDataSource 實例所建置的 。 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>) 前面必須有相同 IApplicationBuilder 實例的呼叫 UseRouting(IApplicationBuilder)

會在 Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware 中介軟體管線中定義一個點,其中會進行路由決策,而 Endpoint 與 相關聯 HttpContext 。 會在 Microsoft.AspNetCore.Routing.EndpointMiddleware 中介軟體管線中定義執行目前 Endpoint 點的點。 和 之間的 Microsoft.AspNetCore.Routing.EndpointRoutingMiddlewareMicrosoft.AspNetCore.Routing.EndpointMiddleware 中介軟體可能會觀察或變更 EndpointHttpContext 相關聯的 。

適用於