Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

.NET 9 Blazor Server - some static assets are not being cached/fingerprinted #59101

Unanswered
BieleckiLtd asked this question in Q&A
Discussion options

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?

image

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))

You must be logged in to vote

Replies: 4 comments

Comment options

The packages' static files don't seem to be affected. We have to wait until their authors also implement MapStaticAssets

You must be logged in to vote
0 replies
Comment options

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

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

@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.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /