无法从Visual Studio 2019 16.6.2调试Blazor托管的Webassembly 3.2.0 [英] Unable to debug Blazor hosted webassembly 3.2.0 from Visual Studio 2019 16.6.2

本文介绍了无法从Visual Studio 2019 16.6.2调试Blazor托管的Webassembly 3.2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Visual Studio 2019 16.6.2,以及.NET Core 3.1.301 SDK和所有必需的Blazor模板.

I have Visual Studio 2019 16.6.2 installed, along with the .NET Core 3.1.301 SDK and all the necessary Blazor templates.

如果我创建了一个全新的Blazor WebAssmbly应用程序,则可以通过按 Ctrl + F5 从Visual Studio中运行它,并在活动的浏览器窗口中打开一个新选项卡然后开始.

If I create a brand new Blazor WebAssmbly application, I can run it from Visual Studio by pressing Ctrl+F5 and it opens a new tab on my active browser window and starts fine.

但是当我按 F5 时,会打开一个新的单独的浏览器窗口(这很烦人),但是该页面停留在about:blank一段时间,直到Visual Studio中出现错误消息为止:

But when I press F5, a new, separate browser window is opened (which is midly annoying), but the page remains at about:blank for a while until an error message appears in 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应用程序托管"到Web服务器.还是没有影响.

Whether the Blazor WebAssembly application is "Hosted" or not doesn't make a difference.

我已经按照

I've followed the steps in the Enforce HTTPS in ASP.NET Core, but that made no difference.

如果在等待about:blank窗口崩溃时,我在浏览器选项卡上手动打开客户端url,则应用程序加载并且调试器断点被击中. 在它崩溃之前的短时间内,如果我按 Shift + Alt + D ,我总是会得到 以下错误:

If, while waiting for the about:blank window to crash, I manually open the client side url on a browser tab, the app loads and the debugger breakpoints are hit. During the short while before it goes on to crash, if I hit Shift+Alt+D I always get the following error:

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/

无论我多久运行一次命令(关闭所有浏览器实例,重新启动等),我每次都会得到此信息.

I get this each and every time, no matter how often I run the command (having closed all browser instances, rebooted, etc).

这在Edge 84(Edgium)和Chrome中都会发生.

This happens in both Edge 84 (Edgium) and Chrome.

我应该能够创建一个新的Blazor WebAssembly应用程序,并在开箱即用的Visual Studio中点击 F5 .我想念什么?

I should be able to create a new Blazor WebAssembly app and hit F5 on Visual Studio out of the box. What am I missing?

我刚刚尝试使用旧边缘" (EdgeHtml)和Firefox作为Visual Studio中的调试浏览器,它们都可以按预期工作(这意味着该应用程序至少在按 F5 时启动).那么问题就变成了两种基于Chromium的浏览器.

I've just tried using "old Edge" (EdgeHtml) and Firefox as the debug browser in Visual Studio, and both work as expected (meaning that the application at least starts up when pressing F5). The problem apears to be both Chromium-based browsers then...

@JamesHancock在评论中发布了一个非常简单的解决方法.要获得完整的解决方案(和说明),我已经记录了Github问题,其中包含ASP.NET Core团队.

@JamesHancock posted an easy enough workaround in the comments. For a full resolution (and explanation), I've logged a Github issue with the ASP.NET Core team.

推荐答案

搜索几天后,我进行了以下操作,它就像魅力一样工作:

After searching for couple of days, I did the following and it worked like charm:

1.安装IE"Microsoft Edge"

1.Install IE "Microsoft edge"

2.使用IE的"Microsoft edge"作为您的VS.浏览器( NOT CHROME )

2.Use IE "Microsoft edge" as your VS. browser (NOT CHROME)

3.将您的应用程序用作服务器(不要IIS EXPRESS ).

3.Use your application as server (NOT IIS EXPRESS).

享受.

这篇关于无法从Visual Studio 2019 16.6.2调试Blazor托管的Webassembly 3.2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆