Blazor server doesn't render pages properly with custom WebApplicationOptions
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
If I use the following code snippet in Program.cs
:
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
ApplicationName = typeof(Program).Assembly.FullName,
ContentRootPath = Path.GetFullPath(Directory.GetCurrentDirectory()),
WebRootPath = "wwwroot",
Args = args
});
Blazor server doesn’t show the web page properly.
Expected Behavior
Blazor server renders the pages properly with custom WebApplicationOptions
.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
6.0.9, 6.0.109
Anything else?
No response
Issue Analytics
- State:
- Created a year ago
- Comments:17 (12 by maintainers)
Top Results From Across the Web
Net 6 Blazor Server-Side CSS Isolation not working
I tried builder.WebHost.UseStaticWebAssets(); on my Program.cs and that didn't work, it errors out on runtime with: "System.
Read more >blazor web app does not render properly · Issue #48714
The new project, OneSite.WebApp, renders the download page properly and displays it. The code is exactly the same. The problem arose when I ......
Read more >Custom UI template doesn't work in blazor-server
I have created a blazor server project and wanted to change the default UI template and use another admin dashboard bootstrap template (LEMA ......
Read more >How to start a blazor server from another application.
Due to this I want to deliver the Blazor UI part as a plug-in. I already have a few plug-ins that are non...
Read more >Render the Blazor Server App in IE11 Browser in Blazor
Learn here all about how to Render the Blazor Server App in IE11 Browser in Blazor ... The Microsoft Internet Explorer doesn't support...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@khteh It’s not obvious to us what is going on here (hence why we marked the issue as investigate).
We will schedule the issue to be looked at in a future milestone based on our triage (To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.) and will provide an update at that point.
A repro project would help to make sure that we can reproduce your exact issue and determine if there is a bug in the framework or a configuration error in the application.
@khteh Glad your issue was resolved!
By default,
ApplicationName
is used to resolve the static web assets manifest file, i.e.<ApplicationName>.staticwebassets.runtime.json
. So, usingtypeof(Program).Assembly.FullName
effectively causes the manifest file name to be resolved to something like<assembly name>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.staticwebassets.runtime.json
, which is incorrect. This will cause all requests to static web assets to 404, including CSS files.Closing this as by-design.