ASP.NET Core中间件

中间件





中间件类



具体实现

点击查看代码
  public class TestMiddleWare
    {
        private readonly RequestDelegate _next;
        public TestMiddleWare(RequestDelegate next)
        {
            _next = next;
        }

        public async Task InvokeAsync(HttpContext context)
        {
            await context.Response.WriteAsync("我是测试中间件 start");
            await _next(context);
            await context.Response.WriteAsync("我是测试中间件 end");

        }
    }
**测试中间件**


posted @ 2022-09-12 11:28  Raymon*码记  阅读(32)  评论(0)    收藏  举报