当前位置:网站首页>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 .
边栏推荐
- UWA Q & a collection
- 23. Merge K ascending linked lists -c language
- Get the week start time and week end time of the current date
- Two kinds of updates lost and Solutions
- OpenGL homework - Hello, triangle
- 微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
- Revit secondary development - collision detection
- ASP.NET Core入门五
- 【Azure微服务 Service Fabric 】如何转移Service Fabric集群中的种子节点(Seed Node)
- 反爬通杀神器
猜你喜欢
【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式
operator
「开源摘星计划」Loki实现Harbor日志的高效管理
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
Customer case | China law network, through observing the cloud, greatly shortens the time of fault location
Redis官方ORM框架比RedisTemplate更优雅
Implementation method of data platform landing
Add get disabled for RC form
Cannot find module 'xxx' or its corresponding type declaration
Crawler (17) - Interview (2) | crawler interview question bank
随机推荐
OpenGL jobs - shaders
如何选择合适的自动化测试工具?
Blender exchange group, welcome to the water group ~
Dayu200 experience officer MPPT photovoltaic power generation project dayu200, hi3861, Huawei cloud iotda
Write in front -- Talking about program development
Visual design form QT designer design gui single form program
Variables and constants
OpenGL configuration vs2019
C # Development -- pit encountered in JS intermodulation
Unity technical notes (I) inspector extension
. Net automapper use
Unity local coordinates and world coordinates
双塔模型的最强出装,谷歌又开始玩起“老古董”了?
Pdf document signature Guide
Use partial derivatives to display normals in unity
Revit secondary development - link file collision detection
Get the exact offset of the element
Remember aximp once Use of exe tool
Which futures company is the safest to open a futures account?
「开源摘星计划」Loki实现Harbor日志的高效管理