无法在VSCode中调试Azure函数核心工具

无法在VSCode中调试Azure函数核心工具,azure,visual-studio-code,azure-functions,azure-functions-core-tools,Azure,Visual Studio Code,Azure Functions,Azure Functions Core Tools,我目前无法在VS代码中调试Azure功能核心工具。 我正在使用npm包azure函数核心-tools@2。 正如我在许多参考资料中读到的那样,func host start/func start应该始终使用--inspect=9229启动节点进程。如您所见,我的设置中并非如此: [4/30/19 4:51:25 AM] Starting language worker process:node "/usr/lib/node_modules/azure-functions-core-tools/

我目前无法在VS代码中调试Azure功能核心工具。 我正在使用npm包
azure函数核心-tools@2
。 正如我在许多参考资料中读到的那样,
func host start
/
func start
应该始终使用
--inspect=9229
启动节点进程。如您所见,我的设置中并非如此:

[4/30/19 4:51:25 AM] Starting language worker process:node  "/usr/lib/node_modules/azure-functions-core-tools/bin/workers/node/dist/src/nodejsWorker.js" --host 127.0.0.1 --port 50426 --workerId 3e909143-72a3-4779-99c7-376ab3aba92b --requestId 656a9413-e705-4db8-b09f-da44fb1f991d --grpcMaxMessageLength 134217728
[4/30/19 4:51:25 AM] node process with Id=92 started
[4/30/19 4:51:25 AM] Generating 1 job function(s)
[...]
[4/30/19 4:51:25 AM] Job host started
Hosting environment: Production
此外,所有更改托管环境的尝试都失败。我试图将
功能\u CORETOOLS\u环境
添加到本地配置中,导致错误:

An item with the same key has already been added. Key: FUNCTIONS_CORETOOLS_ENVIRONMENT
我尝试在启动和任务设置中添加几个环境变量,使用
--debug
,更改项目设置。什么都不管用

我目前正在Windows Linux子系统(WSL)上运行这个程序,除此之外,它运行得非常好


有人知道我做错了什么吗?

我认为默认情况下没有启用调试。您必须设置语言工作者参数,才能使其正常工作

  • local.settings.json中的

    要进行本地调试,请在local.settings.json文件的
    值下添加
    “languageWorkers:node:arguments:”--inspect=5858“
    ,并将调试器附加到端口5858

  • 使用
    func
    CLI

    您可以使用

  • 在VS代码中
    如果您使用VS代码和Azure函数扩展进行开发,则会自动添加--inspect,因为在.vscode/tasks.json
  • 如果愿意,也可以直接设置此环境变量,而不是将其添加到
    local.settings.json

    func host start --language-worker -- --inspect=5858
    
    {
      "version": "2.0.0",
      "tasks": [
        {
          "label": "runFunctionsHost",
          "type": "shell",
          "command": "func host start",
          "isBackground": true,
          "presentation": {
            "reveal": "always"
          },
          "problemMatcher": "$func-watch",
          "options": {
            "env": {
              "languageWorkers__node__arguments": "--inspect=5858"
            }
          },
          "dependsOn": "installExtensions"
        },
        {
          "label": "installExtensions",
          "command": "func extensions install",
          "type": "shell",
          "presentation": {
            "reveal": "always"
          }
        }
      ]
    }