Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 26, 2025

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 type

The MIME type application/manifest+json was chosen to:

  • Match the existing definition in ContentTypeProvider.cs
  • Follow the W3C Web App Manifest specification standard
  • Ensure consistency across the SDK

Testing

  • All existing Blazor WebAssembly tests continue to pass
  • Verified the web.config template includes the new mapping in the correct location
  • Confirmed the change follows the same pattern as other file extension mappings

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

This section details on the original issue you should resolve

<issue_title>Blazor WASM Standalone .webmanifest 404 error</issue_title>
<issue_description>### Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hello. I have a .net9 blazor wasm PWA app. I had some issues w/ caching and saw that there was a FIX in .net10 for re-including the webmanfiest. So I went ahead and added that. However, upon deployment I'm getting a 404 error when deploying to IIS.

Upon inspection, I can see that the default web.config is lacking a <remove fileExtension=".webmanifest" /><mimeMap fileExtension=".webmanifest" mimeType="application/json" />

Adding this manually fixes the console error. But, wouldn't this mean that new .net10 wasm pwa blazor apps will face this same issue? It doesn't seem like there's a easy fix for this for .net9 besides adding a custom web.config. However, I'm not sure what I would be missing from the "default" web.config template since it's autogenerated.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response</issue_description>

<agent_instructions>The fix is likely https://github.com/dotnet/sdk/blob/main/src/BlazorWasmSdk/Targets/BlazorWasm.web.config

Generate an explanation, make the changes if needed and do not add any test.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #51024

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Blazor WASM Standalone .webmanifest 404 error Add .webmanifest MIME type mapping to Blazor WASM web.config template Sep 26, 2025
@Copilot Copilot AI requested a review from javiercn September 26, 2025 10:33
Copilot finished work on behalf of javiercn September 26, 2025 10:33
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.

Blazor WASM Standalone .webmanifest 404 error
2 participants