How to publish a WASM app for offline use

Steve Rehling 85 Reputation points
2024-06-16T17:06:09.7833333+00:00

I have a Blazor WASM app in VS 2022 Community v 17.10.1 that I am trying to run offline, but am getting several "failed to load resource" and one "failed to register a Service Worker" exceptions as shown below.

I followed these instructions to make the app WPA (it wasn't setup that way at first). Consistent with the instructions: the wwwroot files are there, including service-worker.js, manifest.json, and icon-512.png; (2) index.html has the required links and script for the manifest and service worker; and (3) the manifest (.json instead of .webmanifest) looks right.

I'm publishing to Azure with the settings shown below. When I run the published app, the icon that let's me install it appears as it should in the address bar and when I run the installed app it works. But when I disable internet access, the installed app throws the exceptions shown below, including a failure to load manifest.json and blazor.boot.json.

Any idea what I'm missing? I can post images of my wwwroot, index.html and manifest if that might help. Thanks for any thought you have.

Publish Settings

Offline Exceptions

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,465 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 59,551 Reputation points
    2024-06-17T18:14:33.0133333+00:00

    check that you deployed the service-worker-published.js version. the dev version does no caching.