任务27:Middleware管道介绍
HttpContext
图中注册了三个中间件,所有httpContext就会在这三个管道上都执行HttpContext,会在Reponse里面写一些东西。所有东西会叠加到HttpContext的Reponse当中,最后返回给我我们的Reponse中。
接收一个RequestDelegate,再返回一个RequestDelegate
app.Use(next=>{ return (context)=>{ context.Response.WriteAsync("2: in the middle of start..."); return next(context); }; });