InvalidOperationException: 未指定 authenticationScheme,在 ASP.NET Core 2.0 中未找到 DefaultChallengeScheme

Mis*_*orf 2 c# authentication authorization asp.net-core asp.net-core-2.0

我在 mvc web 应用程序中使用 ASP.net core 2。我目前在一个控制器操作上从 AD 组授权,到目前为止它在本地主机上运行良好。现在发布后,而不是获取登录窗口,我收到以下错误:

InvalidOperationException: 未指定 authenticationScheme,也未找到 DefaultChallengeScheme。

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

[Authorize(Roles = "Domain Users")]
Run Code Online (Sandbox Code Playgroud)

我需要在 startup.cs 中添加一些东西还是我错过了其他东西?

Chr*_*att 6

您需要以下内容Startup.cs

services.AddAuthentication(IISDefaults.AuthenticationScheme);
Run Code Online (Sandbox Code Playgroud)


归档时间:

查看次数:

13414 次

最近记录:

5 年,10 月 前