MudBlazor: [Windows] 404 for MudBlazor files on Production

Bug type

Other

Component name

All

What happened?

When we run MudBlazor on Windows 10 in Production mode (dotnet run --environment Production), the MudBlazor files are not served:

The MudBlazor Files could not be fetched from the aspnet backend 404: image

Expected behavior

When i’m running dotnet run --environment Development everthing is fine nad MudBlazor is served properly.

Reproduction link

https://github.com/seriouz/mudblazorEnvironmentTest

Reproduction steps

  • Have Windows (10)
  • Install dotnet 6 rc1 sdk x64
dotnet new blazorserver
dotnet run --environment Production

After this easy steps i get this strange behavior (see Screenshot). It seems MudBlazor could not be served from the virtual _content folder.

Relevant log output

No response

Version (bug)

5.1.4

Version (working)

5.1.4

What browsers are you seeing the problem on?

Firefox, Chrome, Microsoft Edge

On what operating system are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 19 (4 by maintainers)

Most upvoted comments

I ran into this issue recently with another package. See the link below but essentially you need to tack on .UseStaticWebAssets in you builder/startup. I have confirmed this works locally when switching environments as well as containerized all the way to the cloud.

Hope that helps someone as it wasted a good chunk of my time. 😃

https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilderextensions.usestaticwebassets?view=aspnetcore-6.0

Since this issue has been resolved in the 6.x version of MudBlazor and .NET 5 is EOL. This can be closed.

This is not fixed, I’m using Mudblazor 6.0.15 and .Net 6 and just had this issue, if ASPNETCORE_ENVIRONMENT is not “Development” we cannot run the application in Visual Studio.

This needs to be in the installation docs

builder.WebHost.UseStaticWebAssets();

Since this issue has been resolved in the 6.x version of MudBlazor and .NET 5 is EOL. This can be closed.