当前位置:网站首页>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 .
边栏推荐
- Swm32 series tutorial 5-adc application
- 豪华版h5俄罗斯方块小游戏源码
- Google and Stanford jointly issued a document: why do we have to use large models?
- uniapp的swiper动态设置current值不生效解决办法
- 记录一次mycat连接Communications link failure问题解决
- [300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VIII)
- @The role of documented
- What if you are prompted that your connection to this website is not a private connection?
- 一篇文章搞懂数据仓库:元数据分类、元数据管理
- Common solutions for distributed ID - take one
猜你喜欢

EMC EMI磁珠的特性

XSS知识点和20字符短域名绕过

CarSim simulation quick start (XII) - Driver Model (2)

Solve the inherent defects of CNN! Common CNN architecture ccnn is coming | icml2022

数字签名和CA证书

Understanding of spark operator aggregatebykey

Can‘t connect to server on ‘IP‘ (60)

C#,入门教程——程序运行时的调试技巧与逻辑错误探针技术与源代码

Es6: template string

Record a MYCAT connection and solve the problems of communications link failure
随机推荐
Understand CDN
What if the computer file cannot be deleted?
Window 2 - > toolbar (28-1)
PostgreSQL is the world's most advanced open source relational database
XSS knowledge points and 20 character short domain name bypass
How to set it to pop up the right-click menu
Understanding of spark operator aggregatebykey
Is the salary of test / development programmers unbalanced? Busy life, all kinds of job hopping
Will ordinary browsers disclose information? How to protect privacy by using a secure browser?
What if the computer folder cannot be renamed?
单片机IO口控制12V电压通断,MOS和三极管电路
解决EMC、EMI传导干扰的八大方法
Mysql, how can we get the number of rows affected by the query?
MySQL: what is the difference between like and regexp operations?
Openstack dashboard configuring public network access
The even number of an integer queue is placed in the front, the odd number is placed in the back, and the relative position of the even and odd numbers remains unchanged
In QT multithreading, in which thread does the slot function perform analysis
pyspark更改列顺序存入iceberg数据库
[chart component kit] Shanghai daoning provides developers with steema download, trial and tutorial
Kubernetes技术与架构(七)