System.InvalidOperationException: '找不到客户端 '27MarchTemplate.Client'。

System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.'

我已经使用

下载了新的 blazor webassembly 项目模板
dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3

接下来,我在 Visual Studio 2019 年创建了启用 "Asp.Net Core hosted" 和 "authenthication" 的新 Blazor WebAssembly 项目。我将其命名为“27MarchTemplate”

现在我 运行 项目并获得

System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.'

at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.get_Item(String key)

at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.DefaultClientRequestParametersProvider.GetClientParameters(HttpContext context, String clientId)

at _27MarchTemplate.Server.Controllers.OidcConfigurationController.GetClientRequestParameters(String clientId) in C:\VSProjs\BlazorStudyMarchTemplateMarchTemplateMarchTemplate\Server\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()

solution\project 名称以数字开头是个坏主意。

我刚刚创建了名称中没有数字的新解决方案,错误消失了。