共用方式為


FallbackEndpointRouteBuilderExtensions.MapFallback 方法

定義

多載

MapFallback(IEndpointRouteBuilder, RequestDelegate)

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

MapFallback(IEndpointRouteBuilder, String, RequestDelegate)

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

MapFallback(IEndpointRouteBuilder, RequestDelegate)

來源:
FallbackEndpointRouteBuilderExtensions.cs

將特製化 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)

來源:
FallbackEndpointRouteBuilderExtensions.cs

將特製化 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使用路由條件約束來排除靜態檔案的要求。

適用於