Skip to content

[Performance] Switch Store app static asset serving to MapStaticAssets (+ ShortCircuit) #12

@VancouverBen

Description

@VancouverBen

Summary

Update the .NET 10 Blazor Server Store app to use MapStaticAssets instead of UseStaticFiles to get build-time compression, fingerprinting, and improved caching behavior. Consider short-circuiting the pipeline for matched static assets.

Why

Microsoft Learn recommends MapStaticAssets (.NET 9+) for optimized static asset delivery (compression for JS/CSS, fingerprinting, content-based ETags, and cache headers). It can also short-circuit the middleware pipeline for static asset requests.

Guidance (docs)

Acceptance criteria

  • Store uses app.MapStaticAssets() in Program.cs (or equivalent) for static asset delivery.
  • Static asset requests can be configured with .ShortCircuit() where appropriate.
  • Verify the app still serves framework/static assets correctly in Development and Production.

Notes

  • If the app serves any assets added post-deployment or from non-build locations, retain/augment UseStaticFiles only for those scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions