当前位置:网站首页>ASP. Net core foundation V
ASP. Net core foundation V
2022-07-28 08:30:00 【Hua Weiyun】
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 .
边栏推荐
- Recommend a fully open source, feature rich, beautiful interface mall system
- Mysql, how can we get the number of rows affected by the query?
- How to build the protection system of class protection technology of 2022 series of ISO compliance (Part I)
- DCL singleton mode
- MPLS -- multi protocol label switching technology
- Openstack dashboard configuring public network access
- leetcode/排序数组中两个数字之和
- Swm32 series tutorial 5-adc application
- EMC EMI磁珠的特性
- No super high-rise buildings | new regulations: what information does it reveal that no new buildings above 500 meters should be built?
猜你喜欢

Common solutions for distributed ID - take one

See how Google uses pre training weights in target detection tasks | CVPR 2022

Understanding of spark operator aggregatebykey

uniapp的swiper动态设置current值不生效解决办法

Understand the propagation process of EMI electromagnetic interference through five diagrams - the influence of square wave steepness on high-frequency components, the spectrum graph from time sequenc

03 | project deployment: how to quickly deploy a website developed based on the laravel framework

对spark算子aggregateByKey的理解

Five screens, VR, projection, "Wei Xiaoli" rolled up on the intelligent cockpit

No super high-rise buildings | new regulations: what information does it reveal that no new buildings above 500 meters should be built?
![[Qt5] small software with 5 people randomly selected from the bid evaluation expert base](/img/ca/9f6bd6af45e2113c050edf3a65aaf2.png)
[Qt5] small software with 5 people randomly selected from the bid evaluation expert base
随机推荐
The fourth phase (2021-2022) research on the implementation of cloud native technology in traditional industries - central state-owned enterprises was officially released
CAT1 4G+以太网开发板232数据通过4G模块TCP发到服务器
Prescan quick start to master the transportation elements in lesson 14, prescan
[book club issue 13] Chapter 2 notes on the packaging format and coding format of video files
js糖果消消乐小游戏源码
[reprint] man Rsync translation (Chinese Manual of Rsync command)
Prescan quick start to master the road elements of lecture 15
uniapp上下滑屏切换支持视频和图片轮播实现,类似抖音效果
New generation cloud native message queue (II)
Exception handling in SQL Server
本人男,27岁技术经理,收入太高,心头慌得一比
Five screens, VR, projection, "Wei Xiaoli" rolled up on the intelligent cockpit
Unity中队列(Queue)的简单使用
单片机IO口控制12V电压通断,MOS和三极管电路
File editing component
Lecture notes a utility for everyone to generate PCG
Detailed explanation of random number generated by random class
记录一次mycat连接Communications link failure问题解决
(Reprinted) plantuml Quick Guide
CarSim simulation quick start (XII) - Driver Model (2)