c# - Blazor WASM Net 6 Preview 4 Azure AD - 尝试登录时出错 : 'Cannot read property ' toLowerCase' of undefined'

标签 c# blazor blazor-webassembly .net-6.0

我有一个运行 Net 6 Preview 4 的简单 Blazor WASM,我使用本指南进行设置:
https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-azure-active-directory?view=aspnetcore-6.0
确切的代码适用于 Net 5.0(使用相应的 Net 5.0 程序集)
但是,当我升级到 Net 6 时,我收到以下身份验证错误:

There was an error trying to log you in: 'Cannot read property 'toLowerCase' of undefined'
我似乎也无法获得更多细节。这是在 Azure 应用服务自包含发布上发布的。
enter image description here
代码可以在这里找到:
https://github.com/aherrick/BlazorWASM.Net6Prev4.AzureAD

最佳答案

此处讨论了该问题的解决方法:
https://github.com/dotnet/aspnetcore/issues/33312 .
简而言之,问题是由装配修整引起的。解决方法是排除 Microsoft.Authentication.WebAssembly.Msal通过将其包含在客户端项目文件中来进行修剪:

  <ItemGroup>
    <TrimmerRootAssembly Include="Microsoft.Authentication.WebAssembly.Msal" />
  </ItemGroup>

关于c# - Blazor WASM Net 6 Preview 4 Azure AD - 尝试登录时出错 : 'Cannot read property ' toLowerCase' of undefined',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67805062/

相关文章:

c# - 使用谷歌代码自动更新

c# - Blazor WebAssembly 访问数据库

c# - Twitterizer 底层连接已关闭

javascript - 验证 HTTP 请求来自点击 NFC 标签

c# - Blazor:命名空间 'ApplicationPartAttributeAttribute' 中不存在类型或命名空间名称 'Microsoft.AspNetCore.Mvc.ApplicationParts'

c# - 更新页面时 Blazor 服务器 System.ObjectDisposeException 问题

asp.net - Blazor WebAssembly 登录身份验证/从 .well-known/openid-configuration 登录提供本地主机 URL,而不是公共(public) URL

c# - 在 blazor web 程序集中,每秒调用 StateHasChanged() 是最佳选择吗?

azure-web-app-service - Blazor WASM - 尝试让您登录时出错 : 'this._settings.loginMode is undefined'

c# - ajax.actionlink 调用 Controller Action