-
Notifications
You must be signed in to change notification settings - Fork 10.4k
.NET 9 Blazor Server - some static assets are not being cached/fingerprinted #59101
-
Hi.
I'm migrating Blazor Server app to .NET 9 and want to make use of new static assets compression and fingerprinting API. I have changed in Program.cs
to app.MapStaticAssets();
and updated links in App.razor
to <link rel="stylesheet" href="@Assets["css/prism.css"]" />
But still, some assets are not getting fingerprint and are being pulled on every 'soft' refresh with status code 200, while other (MudBlazor for example) are getting 304 Not Modified. Any idea why?
In fact, after switching to MapStaticAssets()
consecutive loads are slightly heavier compared to UseStaticFiles()
because files as MudBlazor.min.js
are not being fulfilled by memory cache any more:
image
IIS, Blazor Server, pre-rendering disabled (render mode InteractiveServerRenderMode(prerender: false))
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 4 comments
-
The packages' static files don't seem to be affected. We have to wait until their authors also implement MapStaticAssets
Beta Was this translation helpful? Give feedback.
All reactions
-
Hello , i have same problem, some assets are not fingerprinted in IIS but in local kestrel it works for all files, those that are not fingerprinted are libman provided in its lib folder. But they are published correctly.
https://stackoverflow.com/questions/79188071/asp-net-mapstaticassets-does-not-serve-files-installed-by-libman/79312056#79312056
Beta Was this translation helpful? Give feedback.
All reactions
-
I've noticed a similar behaviour. I am building a Blazor SSR application with HTMX and if I reference scripts using @Assets[...]
the HTMX script is not cached and is reloaded on each request.
Beta Was this translation helpful? Give feedback.
All reactions
-
@BieleckiLtd I noticed this as well a little while ago and didn't have enough time to ask about it. We are using Blazor Server w/ Prerendering enabled on IIS, Windows Server 2025.
Thanks for bringing it up, I'm curious if anyone can provide insight.
Beta Was this translation helpful? Give feedback.