-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when loading test.html using MapStaticAssets: Failed to load resource: net::ERR_CONTENT_DECODING_FAILED #58940
Comments
@danroth27 I'm facing same issue in blazor wasm standalone app. I upgraded my .net8 blazor wasm standalone app to .net9. The app has authentication setup using oauth and openidconnect. Entire blazor wasm is under authorisation. So when the index.html load usually it wil redirect to identity provider to challenge user. This was working in .net8. But after upgrading to .net9 and when I do dotnet watch run, I see the below blank page. Meanwhile in terminal, When I manually navigate to any URL in my blazor wasm app, it loads the page. But i can see the below error in console And if I click refresh button in browser, I again see the below blank page Now I need to press ctrl + c in terminal and that throws the following error
Again I need to dotnet watch run and index.html will be blank with Now If I rollback to .net8 still the issue persist. net9 installation broke something. I tested this in VS Code in Mac OS sequoia 15.1 and also in Visual Studio in windows 11. Facing same issue in both machines. Looks like local development is blocked because of this. I notice this behavior only in development mode. I tried to publish and run in IIS and I dont see any issue. |
I also have this issue, changing the file extension results in the wrong mime type sent to the browser so doesn't work for my use case. A potential alternative workaround is creating a different static directory for your html files. Then use MapStaticAssets alongside:
I am assuming its valid to use both if UseStaticFiles is set to an alternative directory. |
This is a pain. I have found that the presence of a OK: <!DOCTYPE HTML>
<html>
This file is seemingly served correctly.
</html> Broken: <!DOCTYPE HTML>
<html>
<body>
This file won't render in the browser. Dev tools report "Failed to load
response data: No data found for resource with given identifier".
Yum.
</body>
</html> Hope this helps. |
by default blazor wasm apps will serve |
Same issue,How is it going? |
This bug is still crawling, I have the exact same scenario and symptoms as @danroth27. |
Setting |
@javiercn Will we be fixing this in a patch? |
This issue appears to only happen in VS with browser link enabled. We think the issue is due to how browser link intercepts the response and tries to inject content into it. |
@danroth27 Hello,This problem exists not only when Visual Studio is running. After the code is released and deployed in nginx, net::ERR_CONTENT_DECODING_FAILED will still appear when accessing the corresponding test.html from other computers. |
@danroth27 this issue happens when hot reload is enabled. I'm able to reproduce this in vs code .net 9 standalone blazor wasm app. But when I run without hot reload using --no-hot-reload this is not happening |
@fingers10 Thanks for these additional details! That's probably because of a similar issue where hot reload is trying to inject a script on to the page. |
@fingers10 Hmm, that is odd. Could this possibly be due to a misconfiguration of the compression settings in nginx? |
@danroth27 Any suggestion / workaround for this? its difficult without hot reload |
|
@danroth27 @javiercn I'm facing this issue with standalone blazor wasm app. Where should I add this setting in blazor wasm standalone app? |
In lauchSettings.json Anyway, it seems the issue is due to gzip compression of static assets collides with browser link. You can stop hot reload by adding the following line in launchSettings.json
|
@Mohamed1984 Many thanks for the support and help. @danroth27 @javiercn , I'm surprised..
Now hot reload is working without any issues even if I don't have |
Repro steps:
app.MapStaticAssets()
Run the app and browser to /test.html
Expected result: test.html renders in the browser
Actual result: Failed to load resource: net::ERR_CONTENT_DECODING_FAILED
Workarounds:
app.MapStaticAssets()
forapp.UseStaticFiles()
The text was updated successfully, but these errors were encountered: