1

我正在使用 Blazor wasm 项目。我一直在尝试使用 blazor 启动调试器浏览器开发工具,但我一直收到错误消息

我打

调试热键:Shift+Alt+D(当应用程序有焦点时)

这给了我

无法找到可调试的浏览器选项卡 无法从http://localhost:9222/json获取浏览器选项卡列表。确保 Chrome 在启用调试的情况下运行。

解决方法 关闭所有 Chrome 实例,然后按 Win+R 并输入以下内容:

"%programfiles(x86)%\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 http://localhost:52878/

...然后使用该新选项卡进行调试。

潜在异常:System.Net.Http.HttpRequestException:无法建立连接,因为目标机器主动拒绝了它。---> System.Net.Sockets.SocketException (10061): 由于目标机器主动拒绝,无法建立连接。在 System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancelToken) --- 内部异常堆栈跟踪结束 --- 在 System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancelToken) 在 System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage 请求,布尔 allowHttp2,CancellationToken cancelToken)
在 System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage 请求,CancellationToken 取消令牌)在 System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage 请求,CancellationToken 取消令牌)在 System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage 请求,布尔 doRequestAuth , CancellationToken cancelToken)
在 System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancelToken) 在 System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancelToken) 在 System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at System.Net.Http.HttpClient.GetStringAsyncCore(Task1 getTask) 在 Microsoft.AspNetCore.Builder.BlazorMonoDebugProxyAppBuilderExtensions.GetOpenedBrowserTabs(String debuggerHost) 在 Microsoft.AspNetCore.Builder.BlazorMonoDebugProxyAppBuilderExtensions.DebugHome(HttpContext context)

我关闭了所有 chome 浏览器并运行指示的命令,但它无助于我得到同样的错误

我怀疑这个问题与 Chrome 启动后会产生大量其他 chrome 的事实有关,我可以看到它们在此处输入图像描述

我尝试将它们全部杀死,因此没有运行 chrome,然后启动了不起作用的命令,因为我再次运行了 10 个 chrome。

如何使用 blazor 找到已调试的浏览器选项卡?

4

1 回答 1

1

我正在使用 Blazor webassembly,.NET Core 5.0.100-preview.7.20366.6;Google Chrome 版本 84.0.4147.105(官方版本)(64 位);Visual Studio 2019 预览社区版。

在此处输入图像描述

你会看到这样的消息

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 Google Chrome for your development, follow these instructions:
Press Win+R and enter the following:

chrome --remote-debugging-port=9222 --user-data-dir="C:\Users\donhuvy\AppData\Local\Temp\blazor-chrome-debug" https://localhost:44376/

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\donhuvy\AppData\Local\Temp\blazor-edge-debug" --no-first-run https://localhost:44376/

This should launch a new browser window with debugging enabled..

让我们像导游一样做。

(1)复制这些文本

chrome --remote-debugging-port=9222 --user-data-dir="C:\Users\donhuvy\AppData\Local\Temp\blazor-chrome-debug" https://localhost:44376/

(2)Windows+ ,按+R粘贴,然后按CtrlVEnter

(3)访问http://127.0.0.1:9222/json,你会看到

在此处输入图像描述

这是调试信息。

(4)Shift+ Alt+时D

在此处输入图像描述

于 2020-07-31T12:32:06.370 回答