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

VS Code中调试.NET Isolated Azure Function二次启动失败求助

解决.NET Isolated Azure Functions二次调试失败问题
  • 清理残留进程
    第一次调试结束后,dotnet.exe或func.exe进程可能未完全终止,导致二次调试无法启动:

    • 打开任务管理器(Windows)或活动监视器(macOS),结束所有相关的dotnet或func进程。
    • 也可以通过终端执行命令强制清理:
      Windows:taskkill /F /IM dotnet.exe
      macOS/Linux:pkill dotnet
  • 修改调试配置确保进程完全终止
    调整.vscode/launch.json配置,添加调试后清理任务:

    1. 打开项目下的.vscode/launch.json文件。
    2. 在调试配置中添加postDebugTask,并定义对应的清理任务:
    {
      "version": "0.2.0",
      "configurations": [
        {
          "name": "Attach to .NET Isolated Functions",
          "type": "coreclr",
          "request": "attach",
          "processId": "${command:azureFunctions.pickProcess}",
          "postDebugTask": "clean-func-processes"
        }
      ],
      "tasks": [
        {
          "label": "clean-func-processes",
          "type": "shell",
          "command": "taskkill /F /IM dotnet.exe",
          "problemMatcher": []
        }
      ]
    }
    

    (macOS/Linux用户需将command改为pkill dotnet)

  • 重置Azurite服务
    Azurite异常占用资源也可能导致调试失败:

    • 在VS Code的Azurite扩展面板中点击「Restart Azurite」按钮重启服务。
    • 检查Azurite默认端口(10000、10001、10002)是否被占用,用以下命令排查:
      Windows:netstat -ano | findstr :10000
      macOS/Linux:lsof -i :10000
      若有占用,结束对应进程后再重启Azurite。
  • 更新工具版本
    旧版本的工具可能存在兼容性问题:

    • 更新Azure Functions Core Tools:执行npm install -g azure-functions-core-tools@4(需提前安装Node.js)。
    • 在VS Code扩展市场中,将Azure Functions扩展和C#扩展更新至最新版本。

内容的提问来源于stack exchange,提问作者Rob Bowman

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.09 09:20:23