Fails to load CSS/JS files in Production
See original GitHub issueDescribe the bug I have been working on a project using MudBlazor as the default theme/UI option. And everything has been working well in the development environment. Currently I want to move the project to production, but when I change the ASPNETCORE environment variables to production and restart the application. The application does not load the CSS/JS files.
When I press CTRL+U in Google Chrome to try and access the CSS files I get an error like this:
https://localhost:44332/_content/MudBlazor.ThemeManager/MudBlazorThemeManager.css
This localhost page can’t be foundNo webpage was found for the web address: https://localhost:44332/_content/MudBlazor.ThemeManager/MudBlazorThemeManager.css
HTTP ERROR 404
Some of the errors that gets logged by the application are (visual studio):
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined).
Error: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined).
at https://localhost:44332/_framework/blazor.server.js:1:67390
at Array.forEach (<anonymous>)
at e.findFunction (https://localhost:44332/_framework/blazor.server.js:1:67350)
at v (https://localhost:44332/_framework/blazor.server.js:1:69092)
at https://localhost:44332/_framework/blazor.server.js:1:70038
at new Promise (<anonymous>)
at e.beginInvokeJSFromDotNet (https://localhost:44332/_framework/blazor.server.js:1:70011)
at https://localhost:44332/_framework/blazor.server.js:1:26293
at Array.forEach (<anonymous>)
at e.invokeClientMethod (https://localhost:44332/_framework/blazor.server.js:1:26263)
Microsoft.JSInterop.JSException: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined).
Error: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined).
at https://localhost:44332/_framework/blazor.server.js:1:67390
at Array.forEach (<anonymous>)
at e.findFunction (https://localhost:44332/_framework/blazor.server.js:1:67350)
at v (https://localhost:44332/_framework/blazor.server.js:1:69092)
at https://localhost:44332/_framework/blazor.server.js:1:70038
at new Promise (<anonymous>)
at e.beginInvokeJSFromDotNet (https://localhost:44332/_framework/blazor.server.js:1:70011)
at https://localhost:44332/_framework/blazor.server.js:1:26293
at Array.forEach (<anonymous>)
at e.invokeClientMethod (https://localhost:44332/_framework/blazor.server.js:1:26263)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at MudBlazor.MudDrawer.UpdateHeight()
at MudBlazor.MudDrawer.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'OCFXO1TthOR6x0vTtJrDWcoy2jTww1SG-6MUsT0Je6k'.
Microsoft.JSInterop.JSException: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined).
Error: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined).
at https://localhost:44332/_framework/blazor.server.js:1:67390
at Array.forEach (<anonymous>)
at e.findFunction (https://localhost:44332/_framework/blazor.server.js:1:67350)
at v (https://localhost:44332/_framework/blazor.server.js:1:69092)
at https://localhost:44332/_framework/blazor.server.js:1:70038
at new Promise (<anonymous>)
at e.beginInvokeJSFromDotNet (https://localhost:44332/_framework/blazor.server.js:1:70011)
at https://localhost:44332/_framework/blazor.server.js:1:26293
at Array.forEach (<anonymous>)
at e.invokeClientMethod (https://localhost:44332/_framework/blazor.server.js:1:26263)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at MudBlazor.MudDrawer.UpdateHeight()
at MudBlazor.MudDrawer.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
Error: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
at https://localhost:44332/_framework/blazor.server.js:1:67390
at Array.forEach (<anonymous>)
at e.findFunction (https://localhost:44332/_framework/blazor.server.js:1:67350)
at v (https://localhost:44332/_framework/blazor.server.js:1:69092)
at https://localhost:44332/_framework/blazor.server.js:1:70038
at new Promise (<anonymous>)
at e.beginInvokeJSFromDotNet (https://localhost:44332/_framework/blazor.server.js:1:70011)
at https://localhost:44332/_framework/blazor.server.js:1:26293
at Array.forEach (<anonymous>)
at e.invokeClientMethod (https://localhost:44332/_framework/blazor.server.js:1:26263)
Microsoft.JSInterop.JSException: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
Error: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
at https://localhost:44332/_framework/blazor.server.js:1:67390
at Array.forEach (<anonymous>)
at e.findFunction (https://localhost:44332/_framework/blazor.server.js:1:67350)
at v (https://localhost:44332/_framework/blazor.server.js:1:69092)
at https://localhost:44332/_framework/blazor.server.js:1:70038
at new Promise (<anonymous>)
at e.beginInvokeJSFromDotNet (https://localhost:44332/_framework/blazor.server.js:1:70011)
at https://localhost:44332/_framework/blazor.server.js:1:26293
at Array.forEach (<anonymous>)
at e.invokeClientMethod (https://localhost:44332/_framework/blazor.server.js:1:26263)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at MudBlazor.BrowserWindowSizeProvider.GetBrowserWindowSize()
at MudBlazor.Services.ResizeListenerService.GetBreakpoint()
at MudBlazor.MudHidden.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'OCFXO1TthOR6x0vTtJrDWcoy2jTww1SG-6MUsT0Je6k'.
Microsoft.JSInterop.JSException: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
Error: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
at https://localhost:44332/_framework/blazor.server.js:1:67390
at Array.forEach (<anonymous>)
at e.findFunction (https://localhost:44332/_framework/blazor.server.js:1:67350)
at v (https://localhost:44332/_framework/blazor.server.js:1:69092)
at https://localhost:44332/_framework/blazor.server.js:1:70038
at new Promise (<anonymous>)
at e.beginInvokeJSFromDotNet (https://localhost:44332/_framework/blazor.server.js:1:70011)
at https://localhost:44332/_framework/blazor.server.js:1:26293
at Array.forEach (<anonymous>)
at e.invokeClientMethod (https://localhost:44332/_framework/blazor.server.js:1:26263)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at MudBlazor.BrowserWindowSizeProvider.GetBrowserWindowSize()
at MudBlazor.Services.ResizeListenerService.GetBreakpoint()
at MudBlazor.MudHidden.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
Error: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
at https://localhost:44332/_framework/blazor.server.js:1:67390
at Array.forEach (<anonymous>)
at e.findFunction (https://localhost:44332/_framework/blazor.server.js:1:67350)
at v (https://localhost:44332/_framework/blazor.server.js:1:69092)
at https://localhost:44332/_framework/blazor.server.js:1:70038
at new Promise (<anonymous>)
at e.beginInvokeJSFromDotNet (https://localhost:44332/_framework/blazor.server.js:1:70011)
at https://localhost:44332/_framework/blazor.server.js:1:26293
at Array.forEach (<anonymous>)
at e.invokeClientMethod (https://localhost:44332/_framework/blazor.server.js:1:26263)
Microsoft.JSInterop.JSException: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
Error: Could not find 'mudResizeListener.getBrowserWindowSize' ('mudResizeListener' was undefined).
at https://localhost:44332/_framework/blazor.server.js:1:67390
at Array.forEach (<anonymous>)
at e.findFunction (https://localhost:44332/_framework/blazor.server.js:1:67350)
at v (https://localhost:44332/_framework/blazor.server.js:1:69092)
at https://localhost:44332/_framework/blazor.server.js:1:70038
at new Promise (<anonymous>)
at e.beginInvokeJSFromDotNet (https://localhost:44332/_framework/blazor.server.js:1:70011)
at https://localhost:44332/_framework/blazor.server.js:1:26293
at Array.forEach (<anonymous>)
at e.invokeClientMethod (https://localhost:44332/_framework/blazor.server.js:1:26263)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at MudBlazor.BrowserWindowSizeProvider.GetBrowserWindowSize()
at MudBlazor.Services.ResizeListenerService.GetBreakpoint()
at MudBlazor.MudHidden.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'OCFXO1TthOR6x0
And here are some of the errors that is logged into the browsers developer tools:
Failed to load resource: the server responded with a status of 404 ()
MudBlazor.min.js:1
Failed to load resource: the server responded with a status of 404 ()
Site.css:1
Failed to load resource: the server responded with a status of 404 ()
MudBlazorThemeManager.css:1
Failed to load resource: the server responded with a status of 404 ()
MudBlazor.min.js:1
Failed to load resource: the server responded with a status of 404 ()
blazor.server.js:21 [2021-04-09T07:38:06.018Z]
Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json' or set 'CircuitOptions.DetailedErrors'.
e.log @ blazor.server.js:21
Site.css:1
Failed to load resource: the server responded with a status of 404 ()
MudBlazor.min.css:1
Failed to load resource: the server responded with a status of 404 ()
MudBlazorThemeManager.css:1
Failed to load resource: the server responded with a status of 404 ()
All these errors only occur in the Production and Staging environment. Also I get the same results when I use Microsoft Edge browser.
Expected behavior I expected the MudBlazor static files to load the same in Production as it does in Development environment.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Have same issue here. Made MudBlazor.min.css and MudBlazor.min.js copy and put it into /wwwroot/css/ folder. Then added to _Host.cshtml
Same issue. I need this need further investigation.