Skip to content

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 23, 2025

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:

  • Run in Debug configuration
  • Publish the app instead of just building it
  • Disable the development helper for "hot reloading" assets.

Regression?

  • Yes
  • No

9.0

Risk

  • High
  • Medium
  • Low

We continue to Emit the ETags for .NET 9.0 while using the new property-based approach for .NET 10.0+.

Verification

  • Manual (required)
  • Automated

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?

  • Yes
  • No
  • N/A

@github-actions github-actions bot requested review from tmat and a team as code owners August 23, 2025 11:20
@javiercn
Copy link
Member

dotnet/aspnetcore#63364

@javiercn javiercn force-pushed the backport/pr-50420-to-release/10.0.1xx branch from 820d454 to ae2fb90 Compare August 26, 2025 09:49
@lewing lewing merged commit fbcb587 into release/10.0.1xx Aug 27, 2025
27 checks passed
@lewing lewing deleted the backport/pr-50420-to-release/10.0.1xx branch August 27, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants