我正在使用Visual Studio Code (VSCode)编写.Net Core 2.0应用程序,并希望使用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应用程序launchSettings.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/"
}
}
}
P.S. 问题中显示的端口并不完全是我使用的端口,但对于问题本身并不重要。