当前位置:网站首页>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 .
边栏推荐
- Which futures company is the safest to open a futures account?
- Cataloger integrates lidar and IMU for 2D mapping
- UWA Q & a collection
- Revit secondary development - project file to family file
- VTOL in Px4_ att_ Control source code analysis [supplement]
- OpenGL homework - Hello, triangle
- PDF文档签名指南
- Crawler (17) - Interview (2) | crawler interview question bank
- The essence of analog Servlet
- DBSync新增对MongoDB、ES的支持
猜你喜欢

使用 CustomPaint 绘制基本图形

PKPM 2020 software installation package download and installation tutorial

【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式

反爬通杀神器

What does it mean to prefix a string with F?

如何选择合适的自动化测试工具?
Redis官方ORM框架比RedisTemplate更优雅

0-5VAC转4-20mA交流电流隔离变送器/转换模块

双塔模型的最强出装,谷歌又开始玩起“老古董”了?

Add get disabled for RC form
随机推荐
Redis official ORM framework is more elegant than redistemplate
SAR image quality evaluation
Kaggle-Titanic
The latest Android interview collection, Android video extraction audio
Signal feature extraction +lstm to realize gear reducer fault diagnosis -matlab code
Overseas agent recommendation
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
How to write an augmented matrix into TXT file
使用 BlocConsumer 同时构建响应式组件和监听状态
Implementation method of data platform landing
Px4 autonomous flight
如何选择合适的自动化测试工具?
Pyqt GUI interface and logic separation
Vs custom template - take the custom class template as an example
Interview question 01.02 Determine whether it is character rearrangement - auxiliary array algorithm
DNS series (I): why does the updated DNS record not take effect?
Amesim2016 and matlab2017b joint simulation environment construction
Paint basic graphics with custompaint
如何实现横版游戏中角色的移动控制
100million single men and women "online dating", supporting 13billion IPOs