I have started learning Blazor Webassembly using the Hosted model.
Locally I can create and run a simple Blazor web application using visual studio code.
However, when I publish (in this case to www.myasp.net) the following scripting error occurs on any page:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Unexpected token < in JSON at position 0 SyntaxError: Unexpected token < in JSON at position 0 Microsoft.JSInterop.JSException: Unexpected token < in JSON at position 0 SyntaxError: Unexpected token < in JSON at position 0 at System.Threading.Tasks.ValueTask`1[TResult].get_Result () <0x21ea748 + 0x0002c> in :0 at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync (Microsoft.JSInterop.IJSRuntime jsRuntime, System.String identifier, System.Object[] args) <0x2010058 + 0x000e4> in :0 at
Thank you
Here is the full error:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Unexpected token < in JSON at position 0
SyntaxError: Unexpected token < in JSON at position 0
Microsoft.JSInterop.JSException: Unexpected token < in JSON at position 0
SyntaxError: Unexpected token < in JSON at position 0
at System.Threading.Tasks.ValueTask1[TResult].get_Result () <0x21ea748 + 0x0002c> in <filename unknown>:0 at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync (Microsoft.JSInterop.IJSRuntime jsRuntime, System.String identifier, System.Object[] args) <0x2010058 + 0x000e4> in <filename unknown>:0 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3[TRemoteAuthenticationState,TAccount,TProviderOptions].EnsureAuthService () <0x20084c0 + 0x000ee> in :0
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3[TRemoteAuthenticationState,TAccount,TProviderOptions].GetAuthenticatedUser () <0x2007c20 + 0x000d2> in <filename unknown>:0 at System.Threading.Tasks.ValueTask1[TResult].get_Result () <0x21ebf88 + 0x0002c> in :0
at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3[TRemoteAuthenticationState,TAccount,TProviderOptions].GetUser (System.Boolean useCache) <0x1fcb190 + 0x00136> in <filename unknown>:0 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3[TRemoteAuthenticationState,TAccount,TProviderOptions].GetAuthenticationStateAsync () <0x1fc9ff0 + 0x000d0> in :0
at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync () <0x2135338 + 0x0012e> in :0
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion (System.Threading.Tasks.Task task) <0x2135d90 + 0x000ee> in :0
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x1f67eb0 + 0x0020c> in :0
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x21391a0 + 0x000ca> in :0