首页 > 解决方案 > Blazor WASM 6.0.0-preview.7.21378.6、Visual Studio 2022 预览版 3.1

问题描述

我从模板创建了一个标准的 Blazor WASM 项目,其中包含个人用户帐户、托管 ASP.NET 和配置为 Https,检查了渐进式 Web 应用程序。

运行项目,我在开发工具中得到了这个:

`crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] 未处理的异常渲染组件:无法从 '_configuration/Wtf.Client' createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore 加载设置。 Components.WebAssembly.Authentication/AuthenticationService.js:2:288346

Microsoft.JSInterop.JSException:无法从“_configuration/Wtf.Client”中加载设置 createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346

在 Microsoft.JSInterop.JSRuntime.d__161[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in Microsoft.JSInterop.dll:token 0x60000b3+0x156 at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) in Microsoft.JSInterop.dll:token 0x6000049+0x84 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3.d__27[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,文化=中性,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly .Authentication.RemoteUserAccount,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,Culture=neutral,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions,Microsoft.AspNetCore.Components.WebAssembly .Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000122+0x95 at Microsoft.AspNetCore.Components.WebAssembly.Authentication。远程认证服务3.<GetAuthenticatedUser>d__26[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000120+0x7d at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationServiceAuthorization.dll:token 0x6000043+0xfd at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a5+0x7e at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()。 AspNetCore.Components.dll:token 0x60000a3+0x113 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x6000285+0x65 blazor.webassembly.js:1: 30848 Cookie“PHPSESSID”将很快被视为针对“https://localhost:44344/css/open-iconic/font/fonts/open-iconic.woff”的跨站点 cookie,因为该方案不匹配。open-iconic.woff 暴击:Microsoft.AspNetCore.Components.WebAssembly.Rendering。

Microsoft.JSInterop.JSException:无法从“_configuration/Wtf.Client”中加载设置 createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346

在 Microsoft.JSInterop.JSRuntime.d__161[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in Microsoft.JSInterop.dll:token 0x60000b3+0x156 at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) in Microsoft.JSInterop.dll:token 0x6000049+0x84 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3.d__27[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,文化=中性,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly .Authentication.RemoteUserAccount,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,Culture=neutral,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions,Microsoft.AspNetCore.Components.WebAssembly .Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000122+0x95 at Microsoft.AspNetCore.Components.WebAssembly.Authentication。远程认证服务3.<GetAuthenticatedUser>d__26[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000120+0x7d at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3.d__25[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,文化=中性,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly .Authentication.RemoteUserAccount,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,Culture=neutral,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions,Microsoft.AspNetCore.Components.WebAssembly .Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x600011e+0xa7 at Microsoft.AspNetCore.Components.WebAssembly.Authentication。 RemoteAuthenticationService`3.d__17[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,Culture=neutral,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount,Microsoft。 AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,Culture=neutral,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0。 0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() 在 Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll: 令牌 0x6000110+0x63 在 Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync() 在 Microsoft.AspNetCore 。组件。Authorization.dll:token 0x6000043+0xfd at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a5+0x7e at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle , ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x6000285+0x65 blazor.webassembly.js:1:30848 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] 未处理的异常渲染组件:无法加载来自“_configuration/Wtf.Client”的设置 createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a5+0x7e at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x6000285+0x65 blazor.webassembly.js:1:30848 暴击:Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] 未处理的异常渲染组件:无法从“_configuration/Wtf.Client”加载设置 createUserManager@https://localhost: 44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a5+0x7e at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x6000285+0x65 blazor.webassembly.js:1:30848 暴击:Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] 未处理的异常渲染组件:无法从“_configuration/Wtf.Client”加载设置 createUserManager@https://localhost: 44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346Microsoft.AspNetCore.Components.dll 中的 ComponentState owningComponentState):token 0x6000285+0x65 blazor.webassembly.js:1:30848 暴击:Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] 未处理的异常渲染组件:无法加载设置来自'_configuration/Wtf.Client' createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346Microsoft.AspNetCore.Components.dll 中的 ComponentState owningComponentState):token 0x6000285+0x65 blazor.webassembly.js:1:30848 暴击:Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] 未处理的异常渲染组件:无法加载设置来自'_configuration/Wtf.Client' createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346身份验证/AuthenticationService.js:2:288346身份验证/AuthenticationService.js:2:288346

Microsoft.JSInterop.JSException:无法从“_configuration/Wtf.Client”中加载设置 createUserManager@https://localhost:44344/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:288346

在 Microsoft.JSInterop.JSRuntime.d__161[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in Microsoft.JSInterop.dll:token 0x60000b3+0x156 at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) in Microsoft.JSInterop.dll:token 0x6000049+0x84 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3.d__27[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,文化=中性,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly .Authentication.RemoteUserAccount,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,Culture=neutral,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions,Microsoft.AspNetCore.Components.WebAssembly .Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000122+0x95 at Microsoft.AspNetCore.Components.WebAssembly.Authentication。远程认证服务3.<GetAuthenticatedUser>d__26[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000120+0x7d at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3.d__25[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,文化=中性,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly .Authentication.RemoteUserAccount,Microsoft.AspNetCore.Components.WebAssembly.Authentication,版本=6.0.0.0,Culture=neutral,PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions,Microsoft.AspNetCore.Components.WebAssembly .Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x600011e+0xa7 at Microsoft.AspNetCore.Components.WebAssembly.Authentication。远程认证服务3.<GetAuthenticationStateAsync>d__17[[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationState, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.AspNetCore.Components.WebAssembly.Authentication.ApiAuthorizationProviderOptions, Microsoft.AspNetCore.Components.WebAssembly.Authentication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext() in Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll:token 0x6000110+0x63 at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync() in Microsoft.AspNetCore.Components.Authorization.dll:token 0x6000043+0xfd at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a5+0x7e at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() in Microsoft.AspNetCore.Components.dll:token 0x60000a3+0x113 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x6000285+0x65

有人知道这里发生了什么吗?我确实安装了 Mads Kristensen 的“The Essentials”扩展,如果这很重要的话。

标签: blazor-webassemblyvisual-studio-2022

解决方案


在 VS2020 预览版中创建 Hosted Wasm 项目时,默认启动项目设置为 Client。这种方法适用于一个简单的应用程序(没有 Auth),但它可能是一个小错误。

简单的解决方法是右键单击服务器项目并选择“设置为启动项目”。


推荐阅读