Condividi tramite


FallbackEndpointRouteBuilderExtensions.MapFallback Metodo

Definizione

Overload

MapFallback(IEndpointRouteBuilder, RequestDelegate)

Aggiunge un oggetto specializzato RouteEndpoint all'oggetto IEndpointRouteBuilder che corrisponderà alle richieste per i nomi non file con la priorità più bassa possibile.

MapFallback(IEndpointRouteBuilder, String, RequestDelegate)

Aggiunge un oggetto specializzato RouteEndpoint all'oggetto IEndpointRouteBuilder che corrisponderà al modello fornito con la priorità più bassa possibile.

MapFallback(IEndpointRouteBuilder, RequestDelegate)

Origine:
FallbackEndpointRouteBuilderExtensions.cs

Aggiunge un oggetto specializzato RouteEndpoint all'oggetto IEndpointRouteBuilder che corrisponderà alle richieste per i nomi non file con la priorità più bassa possibile.

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

Parametri

endpoints
IEndpointRouteBuilder

Oggetto IEndpointRouteBuilder da aggiungere alla route.

requestDelegate
RequestDelegate

Delegato eseguito quando l'endpoint è corrispondente.

Restituisce

Oggetto IEndpointConventionBuilder che può essere usato per personalizzare ulteriormente l'endpoint.

Commenti

MapFallback(IEndpointRouteBuilder, RequestDelegate) è destinato a gestire i casi in cui il percorso URL della richiesta non contiene un nome file e nessun altro endpoint corrisponde. Ciò è pratico per il routing delle richieste di contenuto dinamico in un framework SPA, consentendo anche alle richieste di file non esistenti di generare un http 404.

MapFallback(IEndpointRouteBuilder, RequestDelegate) registra un endpoint usando il modello {*path:nonfile}. L'ordine dell'endpoint registrato sarà int.MaxValue.

Si applica a

MapFallback(IEndpointRouteBuilder, String, RequestDelegate)

Origine:
FallbackEndpointRouteBuilderExtensions.cs

Aggiunge un oggetto specializzato RouteEndpoint all'oggetto IEndpointRouteBuilder che corrisponderà al modello fornito con la priorità più bassa possibile.

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

Parametri

endpoints
IEndpointRouteBuilder

Oggetto IEndpointRouteBuilder da aggiungere alla route.

pattern
String

Modello di route.

requestDelegate
RequestDelegate

Delegato eseguito quando l'endpoint è corrispondente.

Restituisce

Oggetto IEndpointConventionBuilder che può essere usato per personalizzare ulteriormente l'endpoint.

Commenti

MapFallback(IEndpointRouteBuilder, String, RequestDelegate) è destinato a gestire i casi in cui non è stato eseguito alcun altro endpoint. Ciò è pratico per il routing delle richieste a un framework SPA.

L'ordine dell'endpoint registrato sarà int.MaxValue.

Questo overload userà il verbatim specificato pattern . Usare il :nonfile vincolo di route per escludere le richieste per i file statici.

Si applica a