語言

StaticFilesEndpointRouteBuilderExtensions.MapFallbackToFile 方法

定義

多載

名稱 Description
MapFallbackToFile(IEndpointRouteBuilder, String)

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder,能將非檔名的請求匹配到最低優先順序。 請求會被導向 ,該 A StaticFileMiddleware 嘗試服務由 所 filePath指定的檔案。

MapFallbackToFile(IEndpointRouteBuilder, String, StaticFileOptions)

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder,能將非檔名的請求匹配到最低優先順序。 請求會被導向 ,該 A StaticFileMiddleware 嘗試服務由 所 filePath指定的檔案。

MapFallbackToFile(IEndpointRouteBuilder, String, String)

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder,能將非檔名的請求匹配到最低優先順序。 請求會被導向 ,該 A StaticFileMiddleware 嘗試服務由 所 filePath指定的檔案。

MapFallbackToFile(IEndpointRouteBuilder, String, String, StaticFileOptions)

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder,能將非檔名的請求匹配到最低優先順序。 請求會被導向 ,該 A StaticFileMiddleware 嘗試服務由 所 filePath指定的檔案。

MapFallbackToFile(IEndpointRouteBuilder, String)

來源:
StaticFilesEndpointRouteBuilderExtensions.cs

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder,能將非檔名的請求匹配到最低優先順序。 請求會被導向 ,該 A StaticFileMiddleware 嘗試服務由 所 filePath指定的檔案。

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

參數

filePath
String

要服務的檔案路徑。

傳回

IEndpointRouteBuilder

備註

MapFallbackToFile(IEndpointRouteBuilder, String) 旨在處理請求的 URL 路徑不包含檔案名稱,且沒有其他端點匹配的情況。 這對於將動態內容的請求路由到 SPA 框架很方便,同時也允許對不存在檔案的請求產生 HTTP 404。

StaticFileOptions StaticFileMiddleware預設的 will 會被使用。

MapFallbackToFile(IEndpointRouteBuilder, String) 以模式 {*path:nonfile}註冊端點。 註冊端點的順序為 int.MaxValue。

適用於

MapFallbackToFile(IEndpointRouteBuilder, String, StaticFileOptions)

來源:
StaticFilesEndpointRouteBuilderExtensions.cs

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder,能將非檔名的請求匹配到最低優先順序。 請求會被導向 ,該 A StaticFileMiddleware 嘗試服務由 所 filePath指定的檔案。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IEndpointConventionBuilder ^ MapFallbackToFile(Microsoft::AspNetCore::Routing::IEndpointRouteBuilder ^ endpoints, System::String ^ filePath, Microsoft::AspNetCore::Builder::StaticFileOptions ^ options);
public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallbackToFile(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string filePath, Microsoft.AspNetCore.Builder.StaticFileOptions options);
static member MapFallbackToFile : Microsoft.AspNetCore.Routing.IEndpointRouteBuilder * string * Microsoft.AspNetCore.Builder.StaticFileOptions -> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder
<Extension()>
Public Function MapFallbackToFile (endpoints As IEndpointRouteBuilder, filePath As String, options As StaticFileOptions) As IEndpointConventionBuilder

參數

filePath
String

要服務的檔案路徑。

傳回

IEndpointRouteBuilder

備註

MapFallbackToFile(IEndpointRouteBuilder, String, StaticFileOptions) 旨在處理請求的 URL 路徑不包含檔案名稱,且沒有其他端點匹配的情況。 這對於將動態內容的請求路由到 SPA 框架很方便,同時也允許對不存在檔案的請求產生 HTTP 404。

MapFallbackToFile(IEndpointRouteBuilder, String, StaticFileOptions) 以模式 {*path:nonfile}註冊端點。 註冊端點的順序為 int.MaxValue。

適用於

MapFallbackToFile(IEndpointRouteBuilder, String, String)

來源:
StaticFilesEndpointRouteBuilderExtensions.cs

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder,能將非檔名的請求匹配到最低優先順序。 請求會被導向 ,該 A StaticFileMiddleware 嘗試服務由 所 filePath指定的檔案。

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

參數

pattern
String

路線模式。

filePath
String

要服務的檔案路徑。

傳回

IEndpointRouteBuilder

備註

MapFallbackToFile(IEndpointRouteBuilder, String, String) 旨在處理請求的 URL 路徑不包含檔案名稱,且沒有其他端點匹配的情況。 這對於將動態內容的請求路由到 SPA 框架很方便,同時也允許對不存在檔案的請求產生 HTTP 404。

StaticFileOptions StaticFileMiddleware預設的 will 會被使用。

註冊端點的順序為 int.MaxValue。

這次過載會使用提供的 pattern 原文。 使用 :nonfile 路由限制來排除靜態檔案的請求。

適用於

MapFallbackToFile(IEndpointRouteBuilder, String, String, StaticFileOptions)

來源:
StaticFilesEndpointRouteBuilderExtensions.cs

在 中RouteEndpoint加入一個專用IEndpointRouteBuilder,能將非檔名的請求匹配到最低優先順序。 請求會被導向 ,該 A StaticFileMiddleware 嘗試服務由 所 filePath指定的檔案。

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

參數

pattern
String

路線模式。

filePath
String

要服務的檔案路徑。

傳回

IEndpointRouteBuilder

備註

MapFallbackToFile(IEndpointRouteBuilder, String, String, StaticFileOptions) 旨在處理請求的 URL 路徑不包含檔案名稱,且沒有其他端點匹配的情況。 這對於將動態內容的請求路由到 SPA 框架很方便,同時也允許對不存在檔案的請求產生 HTTP 404。

註冊端點的順序為 int.MaxValue。

這次過載會使用提供的 pattern 原文。 使用 :nonfile 路由限制來排除靜態檔案的請求。

適用於