ASP.NET Core React模板-找不到客户端ID

时间:2019-12-10 19:04:09

标签: c# reactjs asp.net-core

我已经使用配置了单个帐户登录的React模板创建了ASP.NET Core 3.0应用程序。

此后,我将其升级到3.1版,并且所有内容均可编译和构建。

但是,在运行时,我在默认控制器OidcConfigurationController中收到以下错误:

System.InvalidOperationException
  HResult=0x80131509
  Message=Client 'MyApp' not found.
  Source=Microsoft.AspNetCore.ApiAuthorization.IdentityServer
  StackTrace:
   at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.get_Item(String key)
   at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.DefaultClientRequestParametersProvider.GetClientParameters(HttpContext context, String clientId)
   at MyApp.Web.Controllers.OidcConfigurationController.GetClientRequestParameters(String clientId) in C:\Users\Baha\source\repos\MyApp\src\Web\Controllers\OidcConfigurationController.cs:line 22
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

控制器中的clientId参数源自React文件,特别是ApiAuthorizationConstants.js作为变量ApplicationName

我对此有些迷惑,但是使用带有3.1的React模板创建一个新项目运行很好。

有没有人经历过这种情况或暗示从这里去哪里?

0 个答案:

没有答案