我安装了 Visual Studio 2019 16.6.2,以及 .NET Core 3.1.301 SDK 和所有必要的 Blazor 模板。
如果我创建一个全新的 Blazor WebAssmbly 应用程序,我可以通过按Ctrl+从 Visual Studio 运行它F5,它会在我的活动浏览器窗口中打开一个新选项卡并正常启动。
但是当我按下 时F5,会打开一个新的、单独的浏览器窗口(这有点烦人),但页面会停留about:blank
一段时间,直到 Visual Studio 中出现错误消息:
Failed to launch debug adapter. Additional information may be available in the output window.
Unable to launch browser:
"Could not open wss://localhost:5001/_framework/debug/ws-proxy?browser=wsAFFlocalhostA50821FdevtoolsFbrowserFceed3b95-58ac-470a-b10c-5d139cfd7117": timeout after 60000ms
Blazor WebAssembly 应用程序是否“托管”并没有区别。
我已经按照在 ASP.NET Core 中强制 HTTPS 中的步骤进行操作,但这并没有什么区别。
如果在等待about:blank
窗口崩溃时,我在浏览器选项卡上手动打开客户端 url,应用程序加载并且调试器断点被命中。在它继续崩溃之前的短时间内,如果我点击Shift+ Alt+ ,D我总是会收到以下错误:
Unable to find debuggable browser tab
Could not get a list of browser tabs from http://127.0.0.1:9222/json. Ensure your browser is running with debugging enabled.
Resolution
If you are using Microsoft Edge (80+) for your development, follow these instructions:
Press Win+R and enter the following:
msedge --remote-debugging-port=9222 --user-data-dir="C:\Users\sergi\AppData\Local\Temp\blazor-edge-debug" --no-first-run https://localhost:44372/
无论我多久运行一次命令(关闭所有浏览器实例,重新启动等),我每次都会得到这个。
这发生在 Edge 84 (Edgium) 和 Chrome 中。
我应该能够创建一个新的 Blazor WebAssembly 应用程序并开箱即用地F5使用 Visual Studio。我错过了什么?
更新
我刚刚尝试使用“旧 Edge”(EdgeHtml)和 Firefox 作为 Visual Studio 中的调试浏览器,并且两者都按预期工作(这意味着应用程序至少在按下 时启动F5)。问题似乎是基于 Chromium 的浏览器然后......
更新 2
@JamesHancock 在评论中发布了一个足够简单的解决方法。对于完整的解决方案(和解释),我已经记录了ASP.NET Core 团队的 Github 问题。