Azure函数计时器触发器无法正常工作

时间:2017-11-29 20:23:05

标签: azure azure-functions

我的规格:

  • Windows 10
  • 节点8.9.1
  • Runtime BETA 2.0.11390.0(测试版)

是的,我已经安装了VS Code Azure Functions扩展程序和CLI @beta工具。

所以,我做func new --language JavaScript --template TimerTrigger --name testfunc

输出:

Select a language: JavaScript
Select a template: TimerTrigger
Function name: [TimerTriggerJS] Writing C:\Users\user\code\azure\functions\testfunc\index.js
Writing C:\Users\user\code\azure\functions\testfunc\readme.md
Writing C:\Users\user\code\azure\functions\testfunc\sample.dat
Writing C:\Users\user\code\azure\functions\testfunc\function.json

然后我在终端做func host start --debug vscode,我得到:

                  %%%%%%
                 %%%%%%
            @   %%%%%%    @
          @@   %%%%%%      @@
       @@@    %%%%%%%%%%%    @@@
     @@      %%%%%%%%%%        @@
       @@         %%%%       @@
         @@      %%%       @@
           @@    %%      @@
                %%
                %

[11/29/2017 8:19:39 PM] Reading host configuration file 'C:\Users\user\code\azure\functions\host.json'
[11/29/2017 8:19:39 PM] Host configuration file read:
[11/29/2017 8:19:39 PM] {}
info: Worker.Node.0586fcbb-0c58-48e1-a02e-b0644ace851a[0]
      Start Process: node  --inspect=5858 "C:\Users\user\.azurefunctions\bin\workers\node\dist\src\nodejsWorker.js" --host 127.0.0.1 --port 57233 --workerId 0586fcbb-0c58-48e1-a02e-b0644ace851a --requestId 06b7578c-e1ec-456c-83ee-4c26ce8b9ca3
[11/29/2017 8:19:39 PM] Generating 2 job function(s)
[11/29/2017 8:19:39 PM] Starting Host (HostId=swlaptop2062-377256582, Version=2.0.11370.0, ProcessId=19932, Debug=True, ConsecutiveErrors=0, StartupCount=0, FunctionsExtensionVersion=)
[11/29/2017 8:19:39 PM] Found the following functions:
[11/29/2017 8:19:39 PM] Host.Functions.TriggerHR
[11/29/2017 8:19:39 PM] Host.Functions.testfunc
[11/29/2017 8:19:39 PM]
info: Worker.Node.0586fcbb-0c58-48e1-a02e-b0644ace851a[0]
      Debugger listening on ws://127.0.0.1:5858/9e2f7545-9199-4988-b1eb-12d54f999142
info: Worker.Node.0586fcbb-0c58-48e1-a02e-b0644ace851a[0]
      For help see https://nodejs.org/en/docs/inspector
Listening on http://localhost:7071/
Hit CTRL-C to exit...
info: Worker.Node.0586fcbb-0c58-48e1-a02e-b0644ace851a[0]
      Worker 0586fcbb-0c58-48e1-a02e-b0644ace851a connecting on 127.0.0.1:57233
launch.json for VSCode configured.
[11/29/2017 8:19:40 PM] Job host started
[11/29/2017 8:19:44 PM] Host lock lease acquired by instance ID '000000000000000000000000FFD4EE60'.

所以当我通过POSTMAN http://localhost:7071/admin/functions/testfunc进行POST时,我希望调试器能够启动并运行我的函数,但没有任何反应。

我在浏览器上转到http://localhost:7071并且可以正常运行。我转到http://localhost:7071/admin/functions/testfunc,我找不到404。

我做错了什么?我以为我正在遵循所有正确的步骤。

1 个答案:

答案 0 :(得分:0)

添加

{
    "input": ""
}

在请求正文中,我能够使调用和调试器工作。是的。这就是缺少的一切。现在,我的VSCode调试器工作: - )