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");
}
}
本文来自博客园,作者:Raymon*码记,转载请注明原文链接:https://www.cnblogs.com/RaymonGoGo/p/16685798.html