【问题标题】:AZF Custom Handler Breakpoint not StopAZF 自定义处理程序断点不停止
【发布时间】:2022-01-02 20:06:44
【问题描述】:

AZ 函数的自定义处理程序教程有效,但不会在处理程序内的断点处停止。拥有 Azure Functions 核心工具 - 3.0.3904、VSC 1.63.1 (windows 10)、Node 14.16

项目结构

root
|
|--host.json
|--local.settings
|
|--AF <folder>
|   |-- function.json
|
|--CH <folder>
    |-- app.js
    |-- host.json

带有断点的app.js:

var express = require('express');
var app = express();    // <--Breakpoint stops when starting
app.get('/cf', (req, res)=>
{
    var t=new Date();     // <--Breakpoint won't stop when hit with browser
    return res.json({users: t + "----" });
});
app.listen(port,() => {
    console.log('CH running', 3333)
})

根主机.json

{
  ...
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 3.0.0)"
  },
  "customHandler": {
    "description": {
      "defaultExecutablePath": "node",
      "defaultWorkerPath": "CH/app.js"
    },
    "enableForwardingHttpRequest": true
  },
  "extensions": {"http": {"routePrefix": ""}}
}

local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "node"
  }
}

AF/function.json

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "node"
  }
}

CH/host.json

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  }
}

launch.json

{
        "name": "Launch Program",
        "preLaunchTask": "func: host start",
        "program": "${workspaceFolder}/CH/app.js",
        "request": "launch",
        "skipFiles": [
            "<node_internals>/**"
        ],
        "type": "node"
    }

【问题讨论】:

    标签: azure visual-studio-code azure-functions


    【解决方案1】:

    我们选择在 Re-Factor 之后迁移现有应用,而不是 CH

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-30
      • 1970-01-01
      • 2010-09-05
      • 2015-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-20
      相关资源
      最近更新 更多