我想在本地开发我的 Azure Function App,然后将其发布到 Azure 门户。我正在使用 Azure Functions Core Tools 命令行,我的所有函数都在 Node.js 中。目前,我设法在本地下载我的函数并使用命令获取它们的设置:
func azure functionapp fetch-app-settings
所以在那之后我的 local.settings.json 有正确的设置值。当我进行任何更改时,我也能够成功地将它们发布到 Azure 门户。
现在的问题是我的应用程序中有两个函数,一个是 Http 触发,第二个是 EventHub 触发。当我尝试在本地运行主机时:
func host start
我从控制台得到以下输出:
[10.12.2017 13:03:47] Found the following functions:
[10.12.2017 13:03:47] Host.Functions.HttpTriggerJS1
[10.12.2017 13:03:47]
[10.12.2017 13:03:47] Job host started
[10.12.2017 13:03:47] The following 1 functions are in error:
[10.12.2017 13:03:47] EventHubTriggerJS1: The binding type 'eventHubTrigger' is not registered. Please ensure the type is correct and the binding extension is installed.
当我尝试使用 curl 在本地运行这个 EventHubTriggerJS1 函数时:
curl --request POST -H "Content-Type:application/json" --data '{"input":"sample queue data"}' http://localhost:7071/admin/functions/EventHubTriggerJS1
然后什么也没有发生,所以我想这是这个触发器注册的问题。HttpTriggerJS1 运行完美,我可以在下面访问它
http://localhost:7071/api/HttpTriggerJS1
那么,您知道配置中可能出现的问题吗?顺便说一句,是否可以在本地运行并连接到门户中的远程 EventHub?