简体   繁体   English

Visual Studio Code .NET Core-启动(Web)无法启动浏览器

[英]Visual Studio Code .NET Core - Launch (web) does not start the browser

I am trying to debug a .NET Core WebApi application on Red Hat Linux. 我正在尝试在Red Hat Linux上调试.NET Core WebApi应用程序。 But when I press F5 I get the following in the DEBUG CONSOLE and the browser does not start. 但是,当我按F5键时,在DEBUG CONSOLE中得到以下内容,并且浏览器无法启动。 Thank You 谢谢

Module is optimized and the debugger option 'Just My Code' is enabled. 模块已优化,调试器选项“ Just My Code”已启用。 The program '[4657] TodoApi.dll' has exited with code 0 (0x0). 程序“ [4657] TodoApi.dll”已退出,代码为0(0x0)。

here's what's in the launch.json file 这是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}"
        }
    ]
}

You should place ' http://localhost:5000/api/values ' within the "args" section instead of appending to the "command" section. 您应将“ http:// localhost:5000 / api / values ”放置在"args"部分中,而不是附加到"command"部分中。

So the code, in your case, will be something like: 因此,根据您的情况,代码将类似于:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 来自 SourceLink 的 Visual Studio for Mac Browser.Net Core 代码 - Visual Studio for Mac Browser .Net Core code from SourceLink 在Visual Studio Code中设置.NET Core MVC Web应用 - Setting up a .NET Core MVC web app in Visual Studio Code Visual Studio Code 中 .NET Core Web API 的 EF Core 迁移错误 - EF Core migration error with .NET Core Web API in Visual Studio Code Visual Studio代码-.NET Core测试资源管理器 - Visual Studio Code - .NET Core Test Explorer .Net Core Web Api项目无法使用Visual Studio代码进行调试 - .Net Core Web Api project Can't Debug with Visual studio code .net core 2.1 Web应用程序可在Visual Studio中使用,但在Windows 10中部署到IIS时无法使用 - .net core 2.1 web app works in visual studio but does not work when deployed to IIS in windows 10 Visual Studio-无法启动ASP.NET Core项目 - Visual Studio - Cannot start ASP.NET Core project 为什么Visual Studio在.Net Core上的工作WebAPI代码中报告lambda错误? - Why does Visual Studio report a lambda error in a working WebAPI code on .Net Core? Visual Studio Code 调试默认的 ASP.NET Core MVC WebApp:不起作用 - Visual Studio Code debugging the default ASP.NET Core MVC WebApp: does not work 以编程方式启动 Visual Studio Code - Launch Visual Studio Code Programmatically
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM