public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.Use(async (context, next) => { await context.Response.WriteAsync($"11111111........"); await next.Invoke(); }); app.Use(next => { return (context) => { context.Response.WriteAsync($"222222......."); return next(context); }; }); app.Use(next => { return (context) => { context.Response.WriteAsync($"3333333......."); return next(context); }; }); app.Run(async (context) => { await context.Response.WriteAsync($"4444444......"); }); }