gpt4 book ai didi

Blazor WebAssembly application fails to debug when pathbase is set(设置路径库时,Blazor WebAssembly应用程序调试失败)

转载 作者:bug小助手 更新时间:2023-10-25 15:48:13 25 4
gpt4 key购买 nike



The problem


In a .NET 6.0 Blazor WebAssembly application, when setting pathbase in launchSettings.json, the debugger fails to attach. Using Visual Studio 2022 (v. 17.0.2).

在.NET 6.0 Blazor WebAssembly应用程序中,当在LaunchSettings.json中设置路径库时,调试器无法附加。使用Visual Studio 2022(v17.0.2)。


The Code


wwwroot/index.html


<base href="/app/" />

launchSettings.json


  "profiles": {
"MyApp.UI": {
"commandName": "Project",
"commandLineArgs": "--pathbase=/app",
"launchBrowser": true,
"launchUrl": "app",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"hotReloadEnabled": false,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7177;http://localhost:5177",
"dotnetRunMessages": true
}
}

Without "commandLineArgs": "--pathbase=/app", the app runs fine and the debugger attaches - although, it's not at the right base path.

如果没有“CommandLineArgs”:“--pathbase=/app”,应用程序运行良好,调试器也会附加--尽管它不在正确的基本路径上。


With "commandLineArgs": "--pathbase=/app", I get the following error:
Failed to launch debug adapter...unable to launch browser: could not open wss://localhost:7177/_framework/debug/ws-proxy?browser=...

使用“CommandLineArgs”:“--pathbase=/app”时,我得到以下错误:


更多回答
优秀答案推荐

Only workaround I could find:

我能找到的唯一解决办法是:



  1. Change debug web browser to chrome, edge throws the error.



  2. Change inspect uri to include the subpath:


    "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/app/_framework/debug/ws-proxy?browser={browserInspectUri}",




更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com