InvalidOperationException:未指定authenticationScheme,并且在ASP.NET Core 2.0中没有找到DefaultChallengeScheme [重复]

问题描述 投票:0回答:1

我在mvc Web应用程序中使用ASP.net core 2。我目前正在从一个AD组授权一个Controller动作,到目前为止,它在localhost上运行良好。现在发布后,没有得到登录窗口,而是出现以下错误:

InvalidOperationException:未指定authenticationScheme,并且未找到DefaultChallengeScheme。

这就是我授权广告角色的方式。

[Authorize(Roles = "Domain Users")]

我需要添加一些内容到startup.cs还是我缺少其他内容?

c# authentication asp.net-core authorization asp.net-core-2.0
1个回答
3
投票

Startup.cs中需要以下内容:

services.AddAuthentication(IISDefaults.AuthenticationScheme);
© www.soinside.com 2019 - 2024. All rights reserved.