【发布时间】:2022-01-13 15:04:43
【问题描述】:
我必须在其他地方激活它还是你能帮我?当我运行项目时,它直接进入控制器,中间件没有运行。
这是我的中间件。
public class AuthenticationMiddleWare
{
private RequestDelegate nextDelegate;
public AuthenticationMiddleWare(RequestDelegate next, IConfiguration config)
{
nextDelegate = next;
}
public async Task Invoke(HttpContext httpContext)
{
try
{
// somecode
await nextDelegate.Invoke(httpContext);
}
catch (Exception ex)
{
}
}
}
【问题讨论】:
标签: c# asp.net-core asp.net-core-webapi