我安装了 'Debugger for Chrome' VS Code 扩展,然后我将我的 launch.json 设置为:
{
"version": "0.2.0",
"configurations": [
{
"name": "WebApp Chrome Debug",
"type": "chrome",
"request": "launch",
"url": "http://localhost:5000",
"webRoot": "${workspaceFolder}/Bob/WebApp",
"sourceMapPathOverrides": {
"/*": "/__vscode-remote-uri__/*",
}
},
{
"name": "Launch WebApp (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Bob/WebApp/bin/Debug/WebApp.dll",
"args": [],
"cwd": "${workspaceFolder}/Bob/WebApp",
"console": "externalTerminal",
"internalConsoleOptions": "openOnSessionStart",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
}
}
]
}
首先我使用 Launch WebApp(控制台)配置进行调试:
一旦启动,我以同样的方式运行“WebApp Chrome Debug”配置:
调试: