EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder, Action<IEndpointRouteBuilder>) Method

Definition

Adds a Microsoft.AspNetCore.Routing.EndpointMiddleware middleware to the specified IApplicationBuilder with the EndpointDataSource instances built from configured IEndpointRouteBuilder. The Microsoft.AspNetCore.Routing.EndpointMiddleware will execute the Endpoint associated with the current request.

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

Parameters

builder
IApplicationBuilder

The IApplicationBuilder to add the middleware to.

configure
Action<IEndpointRouteBuilder>

An Action<T> to configure the provided IEndpointRouteBuilder.

Returns

IApplicationBuilder

A reference to this instance after the operation has completed.

Remarks

A call to UseEndpoints(IApplicationBuilder, Action<IEndpointRouteBuilder>) must be preceded by a call to UseRouting(IApplicationBuilder) for the same IApplicationBuilder instance.

The Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware defines a point in the middleware pipeline where routing decisions are made, and an Endpoint is associated with the HttpContext. The Microsoft.AspNetCore.Routing.EndpointMiddleware defines a point in the middleware pipeline where the current Endpoint is executed. Middleware between the Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware and Microsoft.AspNetCore.Routing.EndpointMiddleware may observe or change the Endpoint associated with the HttpContext.

Applies to