Add .webmanifest MIME type mapping to Blazor WASM web.config template #51025
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.
Fixes issue where Blazor WebAssembly PWA applications deployed to IIS would encounter 404 errors when accessing
.webmanifest
files due to missing MIME type configuration.Problem
When deploying Blazor WASM PWA applications to IIS, the generated
web.config
file was missing the necessary MIME type mapping for.webmanifest
files. This caused IIS to return 404 errors when browsers attempted to fetch the web app manifest, breaking PWA functionality.The issue affects all Blazor WASM PWA applications deployed to IIS servers, as the default web.config template in the SDK didn't include support for this file type that was re-included in .NET 10.
Solution
Added the missing MIME type mapping to the
BlazorWasm.web.config
template:<remove fileExtension=".webmanifest" />
- Removes any existing IIS default mapping to prevent conflicts<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
- Maps.webmanifest
files to the correct MIME typeThe MIME type
application/manifest+json
was chosen to:ContentTypeProvider.cs
Testing
This fix ensures that Blazor WASM PWA applications work correctly on IIS without requiring developers to manually customize their web.config files.
Fixes #43849
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.