我创建了带有 .NET Core 支持和内置基本身份验证的 Blazor WebAssembly 应用程序。Microsoft 的预定义模板没有变化。我正在我的开发 PC 上运行应用程序,没有出现任何问题。当我在托管服务器上部署应用程序时,我收到以下错误:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Could not find 'AuthenticationService.init' ('AuthenticationService' was undefined).
Error: Could not find 'AuthenticationService.init' ('AuthenticationService' was undefined).
at http://tomasoplt-001-site1.dtempurl.com/_framework/blazor.webassembly.js:1:1287
at Array.forEach (<anonymous>)
at e.findFunction (http://xxx-001-site1.dtempurl.com/_framework/blazor.webassembly.js:1:1247)
at b (http://xxx-001-site1.dtempurl.com/_framework/blazor.webassembly.js:1:2989)
at http://xxx-001-site1.dtempurl.com/_framework/blazor.webassembly.js:1:3935
at new Promise (<anonymous>)
at Object.beginInvokeJSFromDotNet (http://tomasoplt-001-site1.dtempurl.com/_framework/blazor.webassembly.js:1:3908)
at Object.w [as invokeJSFromDotNet] (http://tomasoplt-001-site1.dtempurl.com/_framework/blazor.webassembly.js:1:64218)
at _mono_wasm_invoke_js_blazor (http://tomasoplt-001-site1.dtempurl.com/_framework/dotnet.5.0.2.js:1:190800)
at do_icall (http://xxx-001-site1.dtempurl.com/_framework/dotnet.wasm:wasm-function[10596]:0x194e58)
Run Code Online (Sandbox Code Playgroud)