【发布时间】:2018-07-21 04:33:48
【问题描述】:
我的目的是使用与默认 5000 不同的端口启动 VSCode 调试器,为此我在“args”数组(命令行参数)和 ASPNETCORE_URLS env 变量中都指定了 url。我正在为 Visual Studio Code 调试器使用以下 launch.json 配置:
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/MotelsBack.API/bin/Debug/netcoreapp2.0/MotelsBack.API.dll",
"args": ["urls=http://localhost:6000"],
"cwd": "${workspaceFolder}/MotelsBack.API",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
//"ASPNETCORE_URLS": "http://localhost:6000" --Commented, however this don't work also
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
调试器在指定端口启动,显示如下:
调试器输出表明可以通过我在前面两个选项中指定的 url 访问应用程序,但是当我从任何资源管理器访问此 url 时,应用程序无法访问,它只是不起作用,但如果我删除来自launch.json的端口定义使用它工作的5000默认端口。
Visual Studio Code 调试器不接受不同的端口?
【问题讨论】:
标签: c# debugging asp.net-core visual-studio-code .net-core