【发布时间】:2017-11-28 22:27:03
【问题描述】:
我有一个 timerTrigger,我想在 VS Code 上进行本地调试,所以我在 host.json 所在的根目录上执行 func host start --debug vscode:
PS C:\Users\user\code\azure\functions> func host start --debug vscode
%%%%%%
%%%%%%
@ %%%%%% @
@@ %%%%%% @@
@@@ %%%%%%%%%%% @@@
@@ %%%%%%%%%% @@
@@ %%%% @@
@@ %%% @@
@@ %% @@
%%
%
[11/28/2017 10:21:30 PM] Reading host configuration file 'C:\Users\user\code\azure\functions\host.json'
[11/28/2017 10:21:30 PM] Host configuration file read:
[11/28/2017 10:21:30 PM] {}
info: Worker.Node.1b2b2430-8e1c-4d66-a3e9-bb1672be5ac2[0]
Start Process: node --inspect=5858 "C:\Users\user\.azurefunctions\bin\workers\node\dist\src\nodejsWorker.js" --host 127.0.0.1 --port 59865 --workerId 1b2b2430-8e1c-4d66-a3e9-bb1672be5ac2 --requestId f52eeb9b-d46b-4791-8504-3f94f380c1e2
[11/28/2017 10:21:31 PM] Generating 1 job function(s)
[11/28/2017 10:21:31 PM] Starting Host (HostId=swlaptop2062-377256582, Version=2.0.11370.0, ProcessId=16752, Debug=True, ConsecutiveErrors=0, StartupCount=0, FunctionsExtensionVersion=)
[11/28/2017 10:21:31 PM] Found the following functions:
[11/28/2017 10:21:31 PM] Host.Functions.TriggerHR
[11/28/2017 10:21:31 PM]
info: Worker.Node.1b2b2430-8e1c-4d66-a3e9-bb1672be5ac2[0]
Debugger listening on ws://127.0.0.1:5858/77692ee0-e279-4463-9974-f8412f5dd3fd
info: Worker.Node.1b2b2430-8e1c-4d66-a3e9-bb1672be5ac2[0]
For help see https://nodejs.org/en/docs/inspector
Listening on http://localhost:7071/
Hit CTRL-C to exit...
launch.json for VSCode configured.
info: Worker.Node.1b2b2430-8e1c-4d66-a3e9-bb1672be5ac2[0]
Worker 1b2b2430-8e1c-4d66-a3e9-bb1672be5ac2 connecting on 127.0.0.1:59865
[11/28/2017 10:21:32 PM] Job host started
[11/28/2017 10:21:32 PM] Host lock lease acquired by instance ID '000000000000000000000000EF9214DA'.
然后我做func run TriggerHR。我明白了:
Error: unknown argument run
Azure Functions Core Tools (2.0.1-beta.21)
Function Runtime Version: 2.0.11370.0
Usage: func [context] [context] <action> [-/--options]
这是function.json 上的TriggerHR:
{
"disabled": false,
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */30 * * * *"
}
]
}
我在 v2 运行时。我什至尝试http://localhost:7071/api/myTimer 并得到localhost cannot be found,尽管http://localhost:7071 为我提供了我的应用正在运行的笑脸窗口。
这是它的布局方式:
- TriggerHR (Timer function)
--index.js
--function.json
|
|
- host.json
- local.settings.json
【问题讨论】:
标签: azure-functions