FallbackEndpointRouteBuilderExtensions.MapFallback 方法

定义

重载

MapFallback(IEndpointRouteBuilder, RequestDelegate)

向 添加专用 RouteEndpoint 的 , IEndpointRouteBuilder 以匹配具有可能最低优先级的非文件名的请求。

MapFallback(IEndpointRouteBuilder, String, RequestDelegate)

向 添加一个专用 RouteEndpoint 的 , IEndpointRouteBuilder 它将与提供的模式匹配,其优先级可能最低。

MapFallback(IEndpointRouteBuilder, RequestDelegate)

向 添加专用 RouteEndpoint 的 , IEndpointRouteBuilder 以匹配具有可能最低优先级的非文件名的请求。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IEndpointConventionBuilder ^ MapFallback(Microsoft::AspNetCore::Routing::IEndpointRouteBuilder ^ endpoints, Microsoft::AspNetCore::Http::RequestDelegate ^ requestDelegate);
public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallback (this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, Microsoft.AspNetCore.Http.RequestDelegate requestDelegate);
static member MapFallback : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder * Microsoft.AspNetCore.Http.RequestDelegate -> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder
<Extension()>
Public Function MapFallback (endpoints As IEndpointRouteBuilder, requestDelegate As RequestDelegate) As IEndpointConventionBuilder

参数

endpoints
IEndpointRouteBuilder

IEndpointRouteBuilder要向其添加路由的 。

requestDelegate
RequestDelegate

终结点匹配时执行的委托。

返回

可用于 IEndpointConventionBuilder 进一步自定义终结点的 。

注解

MapFallback(IEndpointRouteBuilder, RequestDelegate) 用于处理请求的 URL 路径不包含文件名,并且没有其他终结点匹配的情况。 这便于将动态内容的请求路由到 SPA 框架,同时允许对不存在的文件的请求导致 HTTP 404。

MapFallback(IEndpointRouteBuilder, RequestDelegate) 使用模式 {*path:nonfile}注册终结点。 已注册终结点的顺序为 int.MaxValue

适用于

MapFallback(IEndpointRouteBuilder, String, RequestDelegate)

向 添加一个专用 RouteEndpoint 的 , IEndpointRouteBuilder 它将与提供的模式匹配,其优先级可能最低。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IEndpointConventionBuilder ^ MapFallback(Microsoft::AspNetCore::Routing::IEndpointRouteBuilder ^ endpoints, System::String ^ pattern, Microsoft::AspNetCore::Http::RequestDelegate ^ requestDelegate);
public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallback (this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, Microsoft.AspNetCore.Http.RequestDelegate requestDelegate);
static member MapFallback : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder * string * Microsoft.AspNetCore.Http.RequestDelegate -> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder
<Extension()>
Public Function MapFallback (endpoints As IEndpointRouteBuilder, pattern As String, requestDelegate As RequestDelegate) As IEndpointConventionBuilder

参数

endpoints
IEndpointRouteBuilder

IEndpointRouteBuilder要向其添加路由的 。

pattern
String

路由模式。

requestDelegate
RequestDelegate

终结点匹配时执行的委托。

返回

可用于 IEndpointConventionBuilder 进一步自定义终结点的 。

注解

MapFallback(IEndpointRouteBuilder, String, RequestDelegate) 用于处理没有其他终结点匹配的情况。 这便于将请求路由到 SPA 框架。

已注册终结点的顺序为 int.MaxValue

此重载将使用提供的 pattern 逐字。 使用 :nonfile 路由约束排除对静态文件的请求。

适用于