I created a Blazor Wasm standalone app + an ASP.NET Core 8 Web API with Visual Studio 2022. Both are hosted on the same server.
The app runs fine on a desktop or laptop.
But when I try to open it on mobile it fails. Load progress shows 98% and the Blazor's yellow error message at the bottom. I tried it on Android and iOS, both fails.
I searched for the error. There are many topics on it. Here Microsoft's explain the integrity check - Integrity check Here discussion about the error - integrity attribute
I tried these steps:
bin
and obj
foldersBlazorEnableCompression
and BlazorCacheBootResources
web.config
When I compare the integrity key in the console message and in the blazor.boot.json
they are different. I tried to replace the key by adding the key in the message in blazor.boot.json
. It didn't help.
Any suggestions?
Updates
Continue my research.
Looks like the mobile version of browsers compresses the files and they have other hash.
I calculated sha-256 hash of icudt_CJK.dat file and it's the same as in blazor.boot.json (ending ...Hk=). At the same time, the console log shows another hash (ending ...FU=).
I added <EmccMaximumHeapSize>268435456</EmccMaximumHeapSize>
directive to the project file. This tag decreases the maximum memory for the app on mobile device browsers. Didn't help.
Then I tried AOT compilation <RunAOTCompilation>true</RunAOTCompilation>
. It took much longer to compile the project. Didn't help.
When I set <BlazorCacheBootResources>false</BlazorCacheBootResources>
the site doesn't work on both - desktop and mobile platforms.
I get same error
Failed to find a valid digest in the 'integrity' attribute for resource '
Uploaded the test project on another hosting, and it doesn't work on both - desktop and mobile.
Cloned the test project in Rider IDE, published it, deployed it to the host, and got the same error.
I fixed the problem.
The solution is to create Blazor Web App but not WebApi + Blazor WebAssembly Standalone application.
In this way, you get two projects (they are created automatically) - server side and client.
On the server side, you implement API. On the client, you consume the API.
You can move all pages and layout components to the client.
I had to rework my project but now it works. I tested it on two hosting providers.