C# 尝试对ASP.NET Core 3.1使用多个身份验证方案时出现异常

C# 尝试对ASP.NET Core 3.1使用多个身份验证方案时出现异常,c#,asp.net-core,authentication,.net-core,jwt,C#,Asp.net Core,Authentication,.net Core,Jwt,我正在尝试使用ASP.NET Core 3.1添加多个身份验证方案,在尝试向服务器发送承载令牌时遇到此问题: System.InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found. The default schemes can be set using either AddAuthentication(string defaul

我正在尝试使用ASP.NET Core 3.1添加多个身份验证方案,在尝试向服务器发送承载令牌时遇到此问题:

System.InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found. The default schemes can be set using either AddAuthentication(string defaultScheme) or AddAuthentication(Action<AuthenticationOptions> configureOptions).
   at Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, String scheme, AuthenticationProperties properties)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at NWebsec.AspNetCore.Middleware.Middleware.CspMiddleware.Invoke(HttpContext context)
   at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
   at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
   at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
   at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
有人知道我做错了什么吗? 如果我只使用一个方案,两个方案都可以单独工作。

我找到了一个解决方案

我需要补充一点

[Authorize(AuthenticationSchemes=“Custom,keybeapt”)]
在我的基地控制器