[release/10.0.1xx] [StaticWebAssets] Use property for original resource #50453
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix ETag header not found error for compressed resources in Release builds
Description
When running ASP.NET Core applications with compressed static web assets in Release configuration, the runtime throws an
InvalidOperationException
with message "ETag header not found".We removed the additional ETag in production because some servers experience issues with it. For development, we switched to emit the ETag only in the Debug configuration.
The runtime however depended on the ETag being present for development scenarios and when we removed it, it started causing issues with
dotnet run -c Release
.The fix removes the usage of weak ETags for .NET 10.0 and onwards, replacing it with an
original-resource
endpoint property. The SDK will continue to emit weak ETags for .NET 9.0 for backwards compatibility.Fixes #63364
Customer Impact
Users running ASP.NET Core applications with
dotnet run -c Release
serving static files will encounter this error.This blocks development scenarios where developers test Release builds locally without publishing. The error prevents the application from starting properly.
Workarounds:
Regression?
9.0
Risk
We continue to Emit the ETags for .NET 9.0 while using the new property-based approach for .NET 10.0+.
Verification
Manual testing: Verified that ASP.NET Core apps run successfully with the new property based approach.
Automated tests: Updated existing tests and added new test coverage for the property-based approach.
Packaging changes reviewed?