UseExtensions.Use Methode

Definition

Überlädt

Use(IApplicationBuilder, Func<HttpContext,RequestDelegate,Task>)

Fügt der Anforderungspipeline der Anwendung einen inline definierten Middlewaredelegat hinzu. Wenn Sie die nächste Funktion nicht aufrufen, verwenden Sie Run(IApplicationBuilder, RequestDelegate) stattdessen.

Use(IApplicationBuilder, Func<HttpContext,Func<Task>,Task>)

Fügt der Anforderungspipeline der Anwendung einen inline definierten Middlewaredelegat hinzu. Wenn Sie die nächste Funktion nicht aufrufen, verwenden Sie Run(IApplicationBuilder, RequestDelegate) stattdessen.

Verwenden Sie die Verwendung Use(IApplicationBuilder, Func<HttpContext,RequestDelegate,Task>) für eine bessere Leistung, wie unten gezeigt:

app.Use((context, next) =>
{
    return next(context);
});

Use(IApplicationBuilder, Func<HttpContext,RequestDelegate,Task>)

Fügt der Anforderungspipeline der Anwendung einen inline definierten Middlewaredelegat hinzu. Wenn Sie die nächste Funktion nicht aufrufen, verwenden Sie Run(IApplicationBuilder, RequestDelegate) stattdessen.

public static Microsoft.AspNetCore.Builder.IApplicationBuilder Use (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Func<Microsoft.AspNetCore.Http.HttpContext,Microsoft.AspNetCore.Http.RequestDelegate,System.Threading.Tasks.Task> middleware);
static member Use : Microsoft.AspNetCore.Builder.IApplicationBuilder * Func<Microsoft.AspNetCore.Http.HttpContext, Microsoft.AspNetCore.Http.RequestDelegate, System.Threading.Tasks.Task> -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function Use (app As IApplicationBuilder, middleware As Func(Of HttpContext, RequestDelegate, Task)) As IApplicationBuilder

Parameter

middleware
Func<HttpContext,RequestDelegate,Task>

Eine Funktion, die die Anforderung verarbeitet und die angegebene nächste Funktion aufruft.

Gibt zurück

Die IApplicationBuilder-Instanz.

Gilt für:

Use(IApplicationBuilder, Func<HttpContext,Func<Task>,Task>)

Fügt der Anforderungspipeline der Anwendung einen inline definierten Middlewaredelegat hinzu. Wenn Sie die nächste Funktion nicht aufrufen, verwenden Sie Run(IApplicationBuilder, RequestDelegate) stattdessen.

Verwenden Sie die Verwendung Use(IApplicationBuilder, Func<HttpContext,RequestDelegate,Task>) für eine bessere Leistung, wie unten gezeigt:

app.Use((context, next) =>
{
    return next(context);
});
public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ Use(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ app, Func<Microsoft::AspNetCore::Http::HttpContext ^, Func<System::Threading::Tasks::Task ^> ^, System::Threading::Tasks::Task ^> ^ middleware);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder Use (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Func<Microsoft.AspNetCore.Http.HttpContext,Func<System.Threading.Tasks.Task>,System.Threading.Tasks.Task> middleware);
static member Use : Microsoft.AspNetCore.Builder.IApplicationBuilder * Func<Microsoft.AspNetCore.Http.HttpContext, Func<System.Threading.Tasks.Task>, System.Threading.Tasks.Task> -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function Use (app As IApplicationBuilder, middleware As Func(Of HttpContext, Func(Of Task), Task)) As IApplicationBuilder

Parameter

middleware
Func<HttpContext,Func<Task>,Task>

Eine Funktion, die die Anforderung verarbeitet und die angegebene nächste Funktion aufruft.

Gibt zurück

Die IApplicationBuilder-Instanz.

Gilt für: