当前位置:网站首页>ASP. Net core introduction V
ASP. Net core introduction V
2022-07-07 22:37:00 【51CTO】
ASP.NET Core ( Request processing pipeline )
understand ASP.NET Processing pipeline
In order to understand ASP.NET Core Request processing pipeline concept in , Let's revise Startup Class Configure() Method , As shown below . ad locum , We register three middleware components into the request processing pipeline . As you can see , The first two components are used Use() Extension method registered , So they have the opportunity to call the next middleware component in the request processing pipeline. . Last use Run() Extension method registration , Because it will become our termination component , That is, it will not call the next component .

understand ASP.NET Core Request processing pipeline execution order
To understand this , Let's compare the above output with the following figure , Understand in a simpler way ASP.NET Core Request processing pipeline .
When incoming HTTP When the request arrives , It starts with the first middleware component ( namely Middleware1) receive , This component is recorded in the response flow “ Middleware1: incoming request ”. therefore , First , We first see this message on the browser .
The first middleware Recorded information , Then it will call next() Method , This method will invoke second Middleware in the request processing pipeline. , namely Middleware2.
The second middleware Recorded “ middleware 2: incoming request ” Information , So we see the log information after the first log . Then the second middleware call next(), It will invoke third Middleware in the request pipeline. Middleware3.
The third middleware Processing requests , Then generate a response . therefore , The third message we see in the browser is “ Middleware3: The incoming request was processed and a response was generated ”.
The middleware component uses Run() Extension method registered , So it's a terminal component . therefore , From this point on , Request the pipeline to start reverse . This means that control is handed back from the middleware to the second middleware , The second middleware records the information as “ middleware 2: Outgoing response ”, Control is then returned to the first middleware component , The first middleware component records information, just as we can see in the browser , yes “ Middleware1: Outgoing response ”.
Key points to remember :
ASP.NET Core The request processing pipeline consists of a series of middleware components , These middleware components will be called one by one .
Each middleware component can be used in next Method performs some operations before and after calling the next component . The middleware component can also decide not to call the next middleware component , This is called a short circuit request pipeline .
asp.net Middleware components in the core can access incoming requests and outgoing responses .
The most important thing you need to keep in mind is , stay Startup Class Configure The order in which middleware components are added to the method defines the order in which these middleware components will be called upon request and the reverse order to them . Respond to . therefore , Sequence is important for defining the security of an application , Performance and functionality are critical .
Should be . therefore , Sequence is important for defining the security of an application , Performance and functionality are critical .
边栏推荐
- Record layoutrebuild Forcerebuildlayoutimmediate does not take effect
- Remove the default background color of chrome input input box
- The free styling service of Dyson's official direct store is now open for appointment. Pioneer Technology interprets the styling concept of hair care and helps consumers unlock diversified and shiny s
- Welcome to CSDN markdown editor
- 客户案例|华律网,通过观测云大幅缩短故障定位时间
- What does it mean to prefix a string with F?
- [azure microservice service fabric] start the performance monitor in the SF node and set the method of capturing the process
- Interview question 01.02 Determine whether it is character rearrangement - auxiliary array algorithm
- The strongest installation of the twin tower model, Google is playing "antique" again?
- Dayu200 experience officer MPPT photovoltaic power generation project dayu200, hi3861, Huawei cloud iotda
猜你喜欢

Matplotlib quick start
![[azure microservice service fabric] how to transfer seed nodes in the service fabric cluster](/img/b6/e5d525d9c7c28f6ef04c3f59b40eb3.png)
[azure microservice service fabric] how to transfer seed nodes in the service fabric cluster

Vs custom template - take the custom class template as an example

Time standard library

How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525

Robot autonomous exploration series papers environment code

应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设

Firefox browser installation impression notes clipping
![[advanced MySQL] index details (I): index data page structure](/img/e7/fe4591a721a71c3c38d6e4448af6af.png)
[advanced MySQL] index details (I): index data page structure

Build your own website (18)
随机推荐
What if the win11u disk does not display? Solution to failure of win11 plug-in USB flash disk
Matplotlib快速入门
Revit secondary development - intercept project error / warning pop-up
Ren Qian code compilation error modification
PDF文档签名指南
Cannot find module 'xxx' or its corresponding type declaration
怎样写一个增广矩阵到txt文件中
[开源] .Net ORM 访问 Firebird 数据库
Failed to initialize rosdep after installing ROS
OpenGL homework - Hello, triangle
Pdf document signature Guide
Record layoutrebuild Forcerebuildlayoutimmediate does not take effect
Revit secondary development - modify wall thickness
Revit secondary development - shielding warning prompt window
Remember that a development is encountered in the pit of origin string sorting
Robot autonomous exploration DSVP: code parsing
Unity local coordinates and world coordinates
戴森官方直营店免费造型服务现已开放预约 先锋科技诠释护发造型理念,助力消费者解锁多元闪耀造型
Crawler (17) - Interview (2) | crawler interview question bank
Ni9185 and ni9234 hardware settings in Ni Max