ekolis
ekolis

Reputation: 6816

Can't run published Blazor WebAssembly app

The app works just fine when I run it in the Visual Studio debugger, but if I deploy it to a server I get this error in the browser console:

Failed to find a valid digest in the 'integrity' attribute for resource 'http://example.com/pwaexperiment/wwwroot/_framework/wasm/dotnet.3.2.0.js' with computed SHA-256 integrity '80L/hSwps3gjABzV78X6mehoDDgsLkm1pKpSS6fAqiE='. The resource has been blocked.

What does this error mean and how can I fix it?

Upvotes: 6

Views: 4880

Answers (3)

devnoia
devnoia

Reputation: 11

Try to delete the bin and obj folders in the project. Then the compiler will rebuild the blazor.boot.json file with the new hashes. And it loads and passes the hash check on the browser.

Upvotes: 1

Tommix
Tommix

Reputation: 522

Your server may be compressing JS files on the fly, that changes content so integrity fails. Disable compression.

Upvotes: 1

mynkow
mynkow

Reputation: 4558

Try adding the following tag to your project:

<BlazorCacheBootResources>false</BlazorCacheBootResources>

Reference: https://github.com/dotnet/aspnetcore/issues/24505#issuecomment-684857753

Upvotes: 8

Related Questions