c# 自定义授权过滤器 AuthorizeAttribute为什么调试不走代码,但是确有效果?
·
错误原因:
在方法上写的属性名称为: [Authorize]
[Authorize]
[HttpPost]
[Route("api/xxxx/xxx")]
public Message aaaa([FromBody] xxxx req)
自定义的过滤器为:
public class ApiAuthAttribute : AuthorizeAttribute
{
}
解决办法:将 [Authorize] 改为 [ApiAuth]
[ApiAuth]
[HttpPost]
[Route("api/xxxx/xxx")]
public Message aaaa([FromBody] xxxx req)
更多推荐



所有评论(0)