You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地Python 3.11队列触发型Azure函数调试器无法附加问题求助

本地Python 3.11队列触发型Azure函数调试器无法附加问题求助

各位好,我现在遇到个头疼的问题,想请教下大家:

我在Windows 11系统上用VS Code开发一个本地运行的Python 3.11 Azure函数应用,已经装了全套Azure扩展——包括那个包含Functions扩展的Azure Tools扩展包,而且这个扩展包在我们其他类型的函数应用和App Service上都用得好好的。

func host start能正常启动应用,我也连接了远程队列存储账户,往队列里扔消息的话,本地运行的应用也能正常拾取处理。

但我现在想调试代码,在确定会执行的代码行甚至其他行都打了断点,可这些断点从来都没命中过。我知道调试器没附上,因为连调试控制按钮都看不到。

我的配置文件如下:

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Python Functions",
            "type": "debugpy",
            "request": "attach",
            "justMyCode": true,
            "connect": {
                "host": "localhost",
                "port": 7071
            },
            "preLaunchTask": "func: host start",
            "env": {
                "PYDEVD_DISABLE_FILE_VALIDATION": "1"
            }
        }
    ]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "func",
            "label": "func: host start",
            "command": "host start --port 7071 --enable-debugging",
            "problemMatcher": "$func-python-watch",
            "isBackground": true,
            "dependsOn": "pip install (functions)"
        },
        {
            "label": "pip install (functions)",
            "type": "shell",
            "osx": {
                "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
            },
            "windows": {
                "command": "${config:azureFunctions.pythonVenv}\\Scripts\\python -m pip install -r requirements.txt"
            },
            "linux": {
                "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
            },
            "problemMatcher": []
        }
    ]
}

local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true"
  }
}

下面是应用正常运行的截图:
应用正常运行截图

想问问大家,这到底是怎么回事啊?为什么按F5启动后,函数应用能正常跑起来,但调试器就是死活附不上呢?


更新:
我附上了debugpy和Azure Core Function Tools的版本截图:
debugpy与Azure Core Function Tools版本截图

备注:内容来源于stack exchange,提问作者user28500450

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 17:44:30