ASP.NET Core 2.0 Middleware管道介绍

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......");
    });
}

 

猜你喜欢

转载自www.cnblogs.com/lgxlsm/p/9104339.html