1. 程式人生 > 其它 >Error: Could not find 'protectedBrowserStorage.get' ('protectedBrowserStorage' was undefined).

Error: Could not find 'protectedBrowserStorage.get' ('protectedBrowserStorage' was undefined).

warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
      Failed to determine the https port for redirect.
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: Could not find 'protectedBrowserStorage.get' ('protectedBrowserStorage' was undefined).
Error: Could not find 'protectedBrowserStorage.get' ('protectedBrowserStorage' was undefined)

.
    at http://localhost:5000/_framework/blazor.server.js:1:497
    at Array.forEach (<anonymous>)
    at i.findFunction (http://localhost:5000/_framework/blazor.server.js:1:465)
    at E (http://localhost:5000/_framework/blazor.server.js:1:2606)
    at http://localhost:5000/_framework/blazor.server.js:1:3494
    at new Promise (<anonymous>)
    at kt.beginInvokeJSFromDotNet (http://localhost:5000/_framework/blazor.server.js:1:3475)
    at http://localhost:5000/_framework/blazor.server.js:1:72077
    at Array.forEach (<anonymous>)
    at kt._invokeClientMethod (http://localhost:5000/_framework/blazor.server.js:1:72063)
      Microsoft.JSInterop.JSException: Could not find 'protectedBrowserStorage.get' ('protectedBrowserStorage' was undefined).

 at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
         at Microsoft.AspNetCore.ProtectedBrowserStorage.ProtectedBrowserStorage.GetAsync[T](String purpose, String key)
         at Ticketing.Web.Services.UserService.GetUserSession() in
         at Ticketing.Web.Services.UserService.GetAuthenticationStateAsync() in 
         at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync()
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit 'Xz3BBSByaV8JWhu-LWpu6zW20FFjq2ofYDfFhxk06cw'.
      Microsoft.JSInterop.JSException: Could not find 'protectedBrowserStorage.get' ('protectedBrowserStorage' was undefined).

這個瀏覽器F12檢視後臺請求,發現有一堆js檔案沒有載入。

而這些檔案,在專案路徑\wwwroot\lib下。所以,需要publish站點,再執行exe。