Description
Hi,
I'm sure there must be a trivial explanation for this, but I can't find it.
I create a Blazor Web Assembly project from the template. Everything works as expected. I add the nuget, and again it all works fine and when I launch the application in IIS Express, I get the install banner in desktop Chrome, and I can install the application and run it from the desktop icon, etc. No problems at all.
Then I deploy the application to full IIS. The Blazor app downloads and runs as expected. However, the install banner doesn't appear. Looking in the Chrome dev-tools, in the console I get a message that the Service Worker was registered successfully and is controlling http://localhost. However, when I check the application tab, it lists the SW status as redundant. Reloading the page or deleting the SW always results in the same message, saying "uncaught exception in Promise, request failed".
I have searched the web and tried numerous things like custom HTTP headers, opening up permissions on inetpub to Full Control for Everyone, changing the user IIS is running under, using a valid SSL certificate (which shouldn't be necessary for localhost), etc. Always the same thing: the Blazor app downloads and runs correctly, the registration of the SW succeeds, but the status is redundant and stopped.
I have also fiddled with Chrome flags, but that would seem to be useless, since the only difference is running against IIS or Express.
Any idea what I am doing wrong?
Dave
Activity
SQL-MisterMagoo commentedon Dec 15, 2019
I believe you have to serve the application over Https for full functionality of PWA.
smalleythedave commentedon Dec 15, 2019
SQL-MisterMagoo commentedon Dec 18, 2019
I don't know what could be causing this - do you see any differences in the network traffic between IIS and Express?
smalleythedave commentedon Dec 20, 2019
SQL-MisterMagoo commentedon Dec 21, 2019
I have reproduced the problem.
For me, something was going wrong with the list of required files and some of them were erroring on fetch, which breaks the service worker - just removing the failed files manually from the list allowed the service worker to complete and WPA functionality was restored.
I just need to figure out why they are going wrong and how to prevent the service worker from giving up or at least to provide some mechanism where you know why it has given up.
smalleythedave commentedon Dec 21, 2019
smalleythedave commentedon Dec 21, 2019
GregTrevellick commentedon Feb 25, 2020
In my case the manifest.json served up successfully locally using IIS Express (via F5 in VS) with response header content type application/json.
But after deploying to server full IIS served up manifest.json with response header content type text/html (the default I believe). This caused (or was the effect of) a 401 not authorized error when serving up the manifest.json file.
I tried adding a MIME type to IIS for json files to no avail, and tried adding this to startup.cs
but neither worked.
The thing that did work, after much bingling, was to add crossorigin="use-credentials" to the html file (_Host.cshtml) like this:
<link href="/manifest.json" rel="manifest" crossorigin="use-credentials" />
fnils commentedon Mar 20, 2020
I had the same problem in my case it was the start_url in the manifest.json file. It need the full path to the website.
I found the issue generating a report using lighthouse for progressive apps in the audit window in Chrome.
F12 --> Audits.
Maybe everyone knows this already but just in case someone doesn't.
chucker commentedon Mar 20, 2020
@fnils if your base URL isn't
/
, check this comment: #5 (comment)