Azure功能未在本地触发 [英] Azure function is not triggered locally

查看:117
本文介绍了Azure功能未在本地触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VScode在本地开发了我的Azure函数应用程序,并将其推送到蔚蓝的云中,我具有eventhub-trigger函数,我以前通常通过VScode在本地调试代码,但是现在当我运行 func host时start --debuge ,我的应用程序中的功能已启动,但没有任何触发,我可以通过它们的日志在云端看到它们被触发,这让我发疯,为什么它们不是在本地触发的,却被启用了,我多次重启了功能应用程序,但一无所获。
我的应用程序是 https://butterflyfnapp.azurewebsites.net

I developed my Azure function app locally using VScode and pushed it to azure cloud, I have eventhub-trigger functions, I used to debug my code locally through VScode normally, but now when I run func host start --debuge, functions in my app started but nothing is triggered, I can see them triggered on the cloud through their log, it drive me mad, why they are not triggered locally, they are enabled, I restarted my function app several times, but I got nothing. My app is https://butterflyfnapp.azurewebsites.net

推荐答案

除了米哈伊尔(Mikhail),另一种选择是为每种环境(例如云​​和Development / VS)创建事件中心的单独使用者组,并在其中进行配置应用程序设置或local.settings.json。
然后将 ConsumerGroup =%consumergroup% 添加到函数中的EventHubTrigger参数,其中 consumergroup 是设置中变量名称的示例。

In additional to Mikhail, other option is to create a separate consumer group of the Event Hub for each environment such as a cloud and development/VS and configured them in the Application settings or local.settings.json. Then add the ConsumerGroup = "%consumergroup%" to the EventHubTrigger argument in your function, where the consumergroup is an example of the variable name in the settings.

除了上述选项之外,您还可以使用Http POST请求在本地测试非Http触发功能。换句话说,您的功能可以像在门户网站中一样进行本地测试。 此处

Beside the above options, still you have a capability for testing a non-Http trigger function locally using a Http POST request. In other words, your function can be tested locally the same way like is done in the portal. More details here.

以下是使用Http POST请求测试 EventHubTrigger 函数的示例:

The following is an example of the testing EventHubTrigger function using a Http POST request:

url: http:// localhost:7071 / admin / functions / MyFunction

有效载荷:

{
  "input": '{"Id":1234,"Name":"abcd"}'
}

这篇关于Azure功能未在本地触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆