我正在使用 Visual Studio Code (VSCode) 对.Net Core 2.0
App 进行编码,并希望为此使用 VSCode 调试器。我创建了一个launch.json
,它适用于我的前端代码,但我还想调试.Net
代码。但是我的主要问题是我没有使用默认端口(5000 我相信它是默认的)。那么如何更改端口呢?
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (Management.Core)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": ".Net Build (all)",
"program": "${workspaceRoot}/Management.Core/bin/Debug/netcoreapp2.0/Management.Core.dll",
"args": [],
"cwd": "${workspaceRoot}/CpaManagement.Core",
"stopAtEntry": false,
"console": "internalConsole"
},
}
我试图添加一个port: 12345
,但这不是一个可接受的属性。我也尝试添加args: ['-- port=12345']
,但这也不起作用。
我的 .Net Core ApplaunchSettings.json
配置如下:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:8888/",
"sslPort": 45678
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Web": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:12345/"
}
}
}
PS问题中显示的端口不完全是我使用的端口,但这对问题本身无关紧要。