[英]Publish Blazor WASM error after update Visual Studio 2022 to 17.0.4
I'm having a weird issue with publishing my Blazor WASM project to Azure App Service after i updated my Visual Studio 2022 to version 17.0.4在我将 Visual Studio 2022 更新到版本 17.0.4 后,我在将我的 Blazor WASM 项目发布到 Azure 应用服务时遇到了一个奇怪的问题
I used the BrotliDecode to keep my Blazor WASM minimun size when downloading to user browser as Microsoft document mentioned in here当下载到用户浏览器时,我使用 BrotliDecode 来保持我的 Blazor WASM 最小尺寸,如此处提到的Microsoft 文档
I did a clean and rebuild as normal then deploy it to my Azure App Service and I got the error我像往常一样进行了清理和重建,然后将其部署到我的 Azure 应用服务,我得到了错误
TypeError: Failed to execute 'arrayBuffer' on 'Response': body stream already read
and和
blazor.webassembly.js:1 Uncaught (in promise) TypeError: Failed to execute 'arrayBuffer' on 'Response': body stream already read
at blazor.webassembly.js:1
at async blazor.webassembly.js:1
at async blazor.webassembly.js:1
The weird thing is this error only appear on the non www url, if I tried to use the www.奇怪的是,如果我尝试使用 www,则此错误仅出现在非 www url 上。 in the url, the application work normaly.在 url 中,应用程序工作正常。 When I tried to go to the login on the Server which usually be "/Identity/Account/Login", It will redirect me back to the homepage.当我尝试将 go 登录到通常是“/Identity/Account/Login”的服务器上时,它会将我重定向回主页。 I'm a littble bit confuse here.我在这里有点困惑。
Edited: This error only happen in Google Chrome and only with url without www., my application run perfectly on Firefox, Edge, and Opera with or without www.已编辑:此错误仅在 Google Chrome 中发生,并且仅在没有 www. 的 url 中发生,我的应用程序在 Firefox、Edge 和 Opera 上完美运行,无论是否有 www。 Therefore, I'm not sure this is a Chrome issue or something wrong with my configuration.因此,我不确定这是 Chrome 问题还是我的配置有问题。
For anyone looking for answers.对于任何寻找答案的人。 I contacted Azure App Service team and this is a known issue and .NET team already working on this.我联系了 Azure 应用服务团队,这是一个已知问题,.NET 团队已经在解决这个问题。
I resolve this by using this trick.我通过使用这个技巧解决了这个问题。
1/ Remove my Custom Domain without www. 1/ 删除没有 www 的自定义域。 from Custom Domain in Azure App Service.来自 Azure 应用服务中的自定义域。
2/ Remove A record and TXT asuid on Godaddy from the Records section. 2/ 从记录部分删除 Godaddy 上的 A 记录和 TXT asuid。
3/ Add forward domain to www.yourdomain.com 3/ 将转发域添加到www.yourdomain.com
4/ Wait an hour for that forward to be completed. 4/ 等待一个小时以完成该转发。
5/ Remove that Forward from Godaddy. 5/ 从 Godaddy 中删除该 Forward。
6/ Remove A record created automatically by Godaddy for forwarding to www.yourdomain.com . 6/ 删除 Godaddy 自动创建的用于转发到www.yourdomain.com的记录。
7/ Add a new Custom Domain on Azure App Service using a domain without www.. 7/ 使用不带 www 的域在 Azure 应用服务上添加新的自定义域。
8/ Delete old Private Key Certificate of the domain without www. 8/删除没有www的域的旧私钥证书。 if you forgot to delete.如果您忘记删除。
9/ Create a new Private Key Certificate for for the domain without www you just created in the last step. 9/ 为没有您在上一步中创建的 www 的域创建一个新的私钥证书。
10/ Add that new Private Key Certificate to the domain without www. 10/ 将新的私钥证书添加到没有 www 的域中。
11/ Wait a few seconds/minutes to get it effective. 11/等待几秒钟/分钟让它生效。
This is just a way to Trick Google Chrome to regconize your url.这只是欺骗 Google Chrome 以重新调整您的 url 的一种方法。 Forwarding and remove forward is how I resolve this.转发和删除转发是我解决这个问题的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.