[Authorize(Policy = "浏览")] public IActionResult Index() { return View(); }
报错内容如下:
An unhandled exception occurred while processing the request. InvalidOperationException: The AuthorizationPolicy named: '首页' was not found. Microsoft.AspNetCore.Authorization.AuthorizationPolicy+<CombineAsync>d__9.MoveNext()
这是什么情况?如何解决?求助了~谢谢各位,
感觉这.net core好多BUG的样子
我觉得你的controller是不是用 policy="首页"了,而且首页这个policy没有定义。
services.AddAuthorization(option =>
{
option.AddPolicy("admin", policy => policy.RequireClaim("admin"));
});
不解释,你懂的!