Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapStaticAssets optimized for serving the assets that your app has knowledge of at build and publish time. #34097

Open
Rick-Anderson opened this issue Nov 13, 2024 · 0 comments
Assignees
Labels
seQUESTered Identifies that an issue has been imported into Quest. Source - Docs.ms Docs Customer feedback via GitHub Issue ⌚ Not Triaged

Comments

@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Nov 13, 2024

Description

see https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview5/aspnetcore.md

MapStaticAssets works by combining work done at build or publish time to gather information about all the static web assets in your app with a runtime library that is capable of processing that information and using it to better serve the files to the browser.

MapStaticAssets can replace UseStaticFiles in most situations. However, it's optimized for serving the assets that your app has knowledge of at build and publish time. This means that if your app serves assets from other locations on disk, or embedded resources, etc. then using UseStaticFiles is still the right choice.

What are the things that MapStaticAssets does that UseStaticFiles doesn't?

Build and publish time compression for all the assets. Uncompressed static web assets are precompressed using gzip as part of the build and then also with brotli during publish to reduce the download size.

Content based ETags. The Etags for each resource are setup to be the Base64 encoded string of the SHA-256 hash of the content. This ensures that the browser doesn't have to download the file again unless its contents change.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-9.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/static-files.md

Document ID

3fec6e08-fc99-7a5c-796f-3f2347cad891

Article author

@Rick-Anderson


Associated WorkItem - 343311

@Rick-Anderson Rick-Anderson added ⌚ Not Triaged reQUEST Triggers an issue to be imported into Quest Source - Docs.ms Docs Customer feedback via GitHub Issue labels Nov 13, 2024
@Rick-Anderson Rick-Anderson self-assigned this Nov 13, 2024
@sequestor sequestor bot added seQUESTered Identifies that an issue has been imported into Quest. and removed reQUEST Triggers an issue to be imported into Quest labels Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
seQUESTered Identifies that an issue has been imported into Quest. Source - Docs.ms Docs Customer feedback via GitHub Issue ⌚ Not Triaged
Projects
Development

No branches or pull requests

1 participant