在vscode中停止调试后,ng serve仍在运行

时间:2020-09-10 11:42:36

标签: visual-studio-code angular-cli

我正在研究vs代码上的angular&.net核心项目。

调试没有问题,但是当我停止调试ng时,服务进程仍在运行并占用了笔记本的内存。

enter image description here

我必须手动将其杀死。

在停止调试后,如何设置vscode调试器以终止ng服务进程。

注意:ng serve每个调试会话都运行不同的端口。 我的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}/EFS/bin/Debug/netcoreapp3.1/EFS.dll",
        "args": [],
        "cwd": "${workspaceFolder}/EFS",
        "stopAtEntry": false,
        // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
        "serverReadyAction": {
            "action": "openExternally",
            "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
        },
        "env": {
            "ASPNETCORE_ENVIRONMENT": "Development"
        },
        "sourceFileMap": {
            "/Views": "${workspaceFolder}/Views"
        }
    },
    {
        "name": ".NET Core Attach",
        "type": "coreclr",
        "request": "attach",
        "processId": "${command:pickProcess}"
    }
]

}

tasks.json

{
"version": "2.0.0",
"tasks": [
    {
        "label": "build",
        "command": "dotnet",
        "type": "process",
        "args": [
            "build",
            "${workspaceFolder}/EFS/EFS.csproj",
            "/property:GenerateFullPaths=true",
            "/consoleloggerparameters:NoSummary"
        ],
        "problemMatcher": "$msCompile"
    },
    {
        "label": "publish",
        "command": "dotnet",
        "type": "process",
        "args": [
            "publish",
            "${workspaceFolder}/EFS/EFS.csproj",
            "/property:GenerateFullPaths=true",
            "/consoleloggerparameters:NoSummary"
        ],
        "problemMatcher": "$msCompile"
    },
    {
        "label": "watch",
        "command": "dotnet",
        "type": "process",
        "args": [
            "watch",
            "run",
            "${workspaceFolder}/EFS/EFS.csproj",
            "/property:GenerateFullPaths=true",
            "/consoleloggerparameters:NoSummary"
        ],
        "problemMatcher": "$msCompile"
    }
]

}

0 个答案:

没有答案