parent
22ed8e662f
commit
3fddc2f2a7
|
@ -5,7 +5,7 @@ description: Explains middleware and the request pipeline.
|
|||
keywords: ASP.NET Core, Middleware, pipeline, delegate
|
||||
ms.author: riande
|
||||
manager: wpickett
|
||||
ms.date: 02/14/2017
|
||||
ms.date: 08/14/2017
|
||||
ms.topic: article
|
||||
ms.assetid: db9a86ab-46c2-40e0-baed-86e38c16af1f
|
||||
ms.technology: aspnet
|
||||
|
@ -22,9 +22,14 @@ By [Rick Anderson](https://twitter.com/RickAndMSFT) and [Steve Smith](http://ard
|
|||
|
||||
## What is middleware
|
||||
|
||||
Middleware is software that is assembled into an application pipeline to handle requests and responses. Each component chooses whether to pass the request on to the next component in the pipeline, and can perform certain actions before and after the next component is invoked in the pipeline. Request delegates are used to build the request pipeline. The request delegates handle each HTTP request.
|
||||
Middleware is software that is assembled into an application pipeline to handle requests and responses. Each component:
|
||||
|
||||
Request delegates are configured using [Run](https://docs.microsoft.com/aspnet/core/api/microsoft.aspnetcore.builder.runextensions), [Map](https://docs.microsoft.com/aspnet/core/api/microsoft.aspnetcore.builder.mapextensions), and [Use](https://docs.microsoft.com/aspnet/core/api/microsoft.aspnetcore.builder.useextensions) extension methods on the [IApplicationBuilder](https://docs.microsoft.com/aspnet/core/api/microsoft.aspnetcore.builder.iapplicationbuilder) instance that is passed into the `Configure` method in the `Startup` class. An individual request delegate can be specified in-line as an anonymous method (called in-line middleware), or it can be defined in a reusable class. These reusable classes and in-line anonymous methods are *middleware*, or *middleware components*. Each middleware component in the request pipeline is responsible for invoking the next component in the pipeline, or short-circuiting the chain if appropriate.
|
||||
* Chooses whether to pass the request to the next component in the pipeline.
|
||||
* Can perform work before and after the next component in the pipeline is invoked.
|
||||
|
||||
Request delegates are used to build the request pipeline. The request delegates handle each HTTP request.
|
||||
|
||||
Request delegates are configured using [Run](https://docs.microsoft.com/aspnet/core/api/microsoft.aspnetcore.builder.runextensions), [Map](https://docs.microsoft.com/aspnet/core/api/microsoft.aspnetcore.builder.mapextensions), and [Use](https://docs.microsoft.com/aspnet/core/api/microsoft.aspnetcore.builder.useextensions) extension methods. An individual request delegate can be specified in-line as an anonymous method (called in-line middleware), or it can be defined in a reusable class. These reusable classes and in-line anonymous methods are *middleware*, or *middleware components*. Each middleware component in the request pipeline is responsible for invoking the next component in the pipeline, or short-circuiting the chain if appropriate.
|
||||
|
||||
[Migrating HTTP Modules to Middleware](../migration/http-modules.md) explains the difference between request pipelines in ASP.NET Core and the previous versions and provides more middleware samples.
|
||||
|
||||
|
|
Loading…
Reference in New Issue