如何在Windows上使用Visual Studio Code设置Kestrel调试?

Kev*_*aus 9 visual-studio-code kestrel-http-server

我很难找到如何使用launch.json文件在Windows上的Visual Studio Code中设置调试的指令(如果重要,则为10).

有人可以定义如何设置它吗?

Ham*_*lar 1

要使用 Visual Studio 代码进行调试,您必须确保您在调试选项卡中选择的配置已在 launch.json 中正确设置。launch.json 中的配置应该如下所示

"configurations": [
    {
        "name": ".NET Core Launch (console)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/Example.dll",
        "args": [],
        "cwd": "${workspaceRoot}/",
        "stopAtEntry": false
    }]
Run Code Online (Sandbox Code Playgroud)

根据我的经验,最常见的问题是程序 dll 的路径不正确。我会仔细检查该路径是否确实指向您编译的调试 dll。如果没有,请修改此路径或修改调试 URL 的目标位置(第一个更容易)。如果您有任何疑问,请发表评论,我刚刚自己解决了这个问题。