Summary
Audit the static asset set for the Store app and reduce runtime overhead by:
- bundling where appropriate, and/or
- excluding large/rarely-hit directories from the
MapStaticAssets manifest using StaticWebAssetEndpointExclusionPattern, then serving those excluded assets via UseStaticFiles.
Why
Microsoft Learn notes that MapStaticAssets loads build-time metadata eagerly to enable compression/caching/fingerprinting, which increases memory usage. For ~1,000+ assets or large infrequently accessed collections, bundling or combining MapStaticAssets (critical assets) + UseStaticFiles (excluded assets) can be a better tradeoff.
Guidance (docs)
Acceptance criteria
- Identify candidate directories (e.g., icon/legacy image libraries) that are rarely used.
- Update
.csproj with StaticWebAssetEndpointExclusionPattern (preserving $(StaticWebAssetEndpointExclusionPattern)), if needed.
- Ensure excluded assets are still served via
UseStaticFiles and remain accessible.
- Verify caching behavior in Production remains correct for both sets of assets.
Summary
Audit the static asset set for the
Storeapp and reduce runtime overhead by:MapStaticAssetsmanifest usingStaticWebAssetEndpointExclusionPattern, then serving those excluded assets viaUseStaticFiles.Why
Microsoft Learn notes that
MapStaticAssetsloads build-time metadata eagerly to enable compression/caching/fingerprinting, which increases memory usage. For ~1,000+ assets or large infrequently accessed collections, bundling or combiningMapStaticAssets(critical assets) +UseStaticFiles(excluded assets) can be a better tradeoff.Guidance (docs)
StaticWebAssetEndpointExclusionPattern: https://learn.microsoft.com/aspnet/core/fundamentals/static-files?view=aspnetcore-10.0#large-collection-of-assetsAcceptance criteria
.csprojwithStaticWebAssetEndpointExclusionPattern(preserving$(StaticWebAssetEndpointExclusionPattern)), if needed.UseStaticFilesand remain accessible.