vscode ubuntu asp .net core 3.1服务在调用api请求时立即以代码0退出

问题描述

在ubuntu asp.net core 3.1服务中的vscode中调试时,此服务将启动并在ip:port上侦听。问题是,如果我在该ip:port上发送api请求,服务将立即退出代码为0。

Hosting environment: Development
Content root path: /home/name/project
Now listening on: http://0.0.0.0:5020
Application started. Press Ctrl+C to shut down.

The program '[11834] WebService.dll' has exited with code 0 (0x0).

如果使用dotnet run命令运行服务,则不会出现此问题,但是我无法调试。

请问我的launch.json和task.json是否有问题?

launch.json

        {
        "version": "0.2.0","configurations": [         
            {
                "name": ".NET Core Launch (console)","type": "coreclr","request": "launch","prelaunchTask": "build","program": "${workspaceFolder}/path/bin/Debug/netcoreapp3.1/WebService.dll","args": ["--urls","http://0.0.0.0:5020"],"cwd": "${workspaceFolder}","stopAtEntry": false,"console": "internalConsole","env": {
                    "ASPNETCORE_ENVIRONMENT": "Development"
                },},{
                "name": ".NET Core Attach","request": "attach","processId": "${command:pickProcess}"
            }
        ]
    }

task.json

{
    "version": "2.0.0","tasks": [
        {
            "label": "build","command": "dotnet","type": "shell","args": [
                "build","/property:GenerateFullPaths=true","/consoleloggerparameters:NoSummary"
            ],"group": "build","presentation": {
                "reveal": "silent"
            },"problemmatcher": "$msCompile"
        }
    ]
}

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)