azure - VSCode 中的 Python Azure Function (HTTPTrigger) 调试未正确启动 Func Host Start

标签 azure visual-studio-code azure-functions vscode-debugger azure-functions-core-tools

问题: enter image description here

所有依赖项,如Python 3.6,Windows环境变量都已设置,必要的requirement.txt已手动安装在我的.env(我的虚拟环境)中,API客户端已安装,

错误:我得到如下 h

我的 launch.json 看起来像这样,不知道如何解决这个问题 - 我怀疑 vscode 配置有问题

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Attach to Python Functions",
      "type": "python",
      "request": "attach",
      "port": 9091,
      "host": "localhost",
      "preLaunchTask": "runFunctionsHost"
    }
  ]
}

感谢任何指导或帮助。

最佳答案

您可以将 .vscode/tasks.json 文件更新为类似的内容,以便使用 bash

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "runFunctionsHost",
      "type": "shell",
      "osx": {
        "command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func extensions install && pip install -r requirements.txt && func host start"
      },
      "windows": {
        "command": ". ${config:azureFunctions.pythonVenv}/Scripts/activate ; func extensions install ; pip install -r requirements.txt ; func host start"
      },
      "linux": {
        "command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func extensions install && pip install -r requirements.txt && func host start"
      },
      "isBackground": true,
      "options": {
        "env": {
          "languageWorkers__python__arguments": "-m ptvsd --host 127.0.0.1 --port 9091"
        }
      },
      "problemMatcher": "$func-watch"
    },
    {
      "label": "funcPack",
      "type": "shell",
      "osx": {
        "command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func pack"
      },
      "windows": {
        "command": ". ${config:azureFunctions.pythonVenv}/Scripts/activate ; func pack"
      },
      "linux": {
        "command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func pack"
      },
      "isBackground": true
    }
  ]
}

请注意windows命令的变化

关于azure - VSCode 中的 Python Azure Function (HTTPTrigger) 调试未正确启动 Func Host Start,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53677160/

相关文章:

python - Visual Studio Code Python 中的 "Assertion ' __builtin_expect(__n < this->size(), true) ' failed"错误

c# - Azure持久框架功能应用程序非常慢

spring-boot - 如何使用 Spring Boot Starter oAuth2 客户端在从 Azure Active Directory (AAD) 返回的 OAuth2User 中包含更多属性

azure - 默认情况下,Azure 子网中的 VM 之间的所有端口是否均开放

go - 在 vscode 中未检测到 env 文件

javascript - 如何在 Node.js 中正确创建 Promise

创建 Azure SQL 数据库时的 Azure 自动化或 Azure Function

c# - 从 azure 函数调用 Web api 的最佳方法

python - 无法使用python从Azure Key Vault获取 secret /证书| 'KeyVaultManagementClient' 对象没有属性 'get_secret'

.net - 从 Windows Azure 上的 .NET 应用程序连接到 VPN?