共用方式為


EndpointRouteBuilderExtensions.MapFallback 方法

定義

多載

MapFallback(IEndpointRouteBuilder, Delegate)

將特製化 RouteEndpoint 新增至 IEndpointRouteBuilder ,以符合具有最低可能優先順序的非檔案名要求。

MapFallback(IEndpointRouteBuilder, String, Delegate)

將特製化 RouteEndpoint 新增至 IEndpointRouteBuilder ,將符合所提供模式且優先順序最低。

MapFallback(IEndpointRouteBuilder, Delegate)

將特製化 RouteEndpoint 新增至 IEndpointRouteBuilder ,以符合具有最低可能優先順序的非檔案名要求。

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapFallback (this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, Delegate handler);
static member MapFallback : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder * Delegate -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function MapFallback (endpoints As IEndpointRouteBuilder, handler As Delegate) As RouteHandlerBuilder

參數

endpoints
IEndpointRouteBuilder

IEndpointRouteBuilder 加入路由的 。

handler
Delegate

比對端點時所執行的委派。

傳回

RouteHandlerBuilder 可用來進一步自訂端點。

備註

MapFallback(IEndpointRouteBuilder, Delegate) 用於處理要求 URL 路徑不包含檔案名,且沒有其他端點相符的情況。 這方便將動態內容的要求路由傳送至 SPA 架構,同時允許要求不存在的檔案產生 HTTP 404。

MapFallback(IEndpointRouteBuilder, Delegate) 使用 模式 {*path:nonfile} 註冊端點。 已註冊端點的順序將是 int.MaxValue

適用於

MapFallback(IEndpointRouteBuilder, String, Delegate)

將特製化 RouteEndpoint 新增至 IEndpointRouteBuilder ,將符合所提供模式且優先順序最低。

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapFallback (this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, Delegate handler);
static member MapFallback : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder * string * Delegate -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function MapFallback (endpoints As IEndpointRouteBuilder, pattern As String, handler As Delegate) As RouteHandlerBuilder

參數

endpoints
IEndpointRouteBuilder

IEndpointRouteBuilder 加入路由的 。

pattern
String

路由模式。

handler
Delegate

比對端點時所執行的委派。

傳回

RouteHandlerBuilder 可用來進一步自訂端點。

備註

MapFallback(IEndpointRouteBuilder, String, Delegate) 是用來處理沒有其他端點相符的情況。 這很方便將要求路由傳送至 SPA 架構。

已註冊端點的順序將是 int.MaxValue

此多載將使用提供的 pattern 逐字。 :nonfile使用路由條件約束來排除靜態檔案的要求。

適用於