gpt4 book ai didi

c# - Visual Studio Code .NET Core - Launch (web) 不启动浏览器

转载 作者:太空宇宙 更新时间:2023-11-04 12:14:46 25 4
gpt4 key购买 nike

我正在尝试在 Red Hat Linux 上调试 .NET Core WebApi 应用程序。但是当我按 F5 时,我在 DEBUG CONSOLE 中看到以下内容,并且浏览器没有启动。谢谢你

模块已优化,调试器选项“仅我的代码”已启用。程序“[4657] TodoApi.dll”已退出,代码为 0 (0x0)。

这是 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}/bin/Debug/netcoreapp2.0/TodoApi.dll",
"args": [],
"cwd": "${workspaceFolder}",
"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 http://localhost:5000/api/values"
}
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

最佳答案

您应该放置 ' http://localhost:5000/api/values ' 在 "args" 部分中,而不是附加到 "command" 部分。

因此,在您的情况下,代码将类似于:

"linux": {
"command": "xdg-open",
"args": "http://localhost:5000/api/values"
}

关于c# - Visual Studio Code .NET Core - Launch (web) 不启动浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47786027/

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