Azure function doesn#39;t notify my bot (Bot Framework)(Azure 函数不通知我的机器人(机器人框架))
问题描述
我正在使用每 X 分钟执行一次的 Azure 函数(定时器触发函数).我已经使用 BotFramework 制作了一个机器人,并且我希望每 x 分钟触发一次 azure 函数.当它被触发时,我的机器人必须得到通知.
i'm using an Azure Function (Timer Trigger Function) which is execute every X minutes. I've made a bot using BotFramework, and I want to have an azure function triggered every x minutes. And when it's triggered my bot must be notified.
我有一个输出 Bot Framework:
I have for that an output Bot Framework :
这是我的 JSON 文件:
Here is my JSON file :
{
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */1 * * * *"
},
{
"type": "bot",
"name": "message",
"botId": "Azurefunction",
"secret": "h3VkHcc_PXU.cwA.XXXXXX.XXXXXXXX-XXX",
"direction": "out"
}
],
"disabled": false
}
而我的功能是:
using System;
using System.Net;
using System.Net.Http;
using Microsoft.Azure.WebJobs.Host;
public class BotMessage
{
public string Source { get; set; }
public string Message { get; set; }
}
public static BotMessage Run(TimerInfo myTimer ,TraceWriter log)
{
BotMessage message = new BotMessage()
{
Source = "AzureFunction",
Message = "Testing"
};
return message;
}
我仍然有一个警告,我不知道为什么(可能是问题所在)...警告 AF004:缺少名为消息"的绑定参数.不匹配的绑定参数名称可能会导致函数索引错误.
I still have a warning i don't know why (maybe it's the problem) ... warning AF004: Missing binding argument named 'message'. Mismatched binding argument names may lead to function indexing errors.
有了这些东西,Azure 功能运行良好,但似乎我的机器人没有收到通知.我是不是忘记了什么?
With this stuff the Azure function is working well but it seems that my bot is not notified. Did i forgot something ?
2017-03-03T13:05:00.001 Function started (Id=a5be778e-da6d-4957-a7b5-d9c8f58bd396)
2017-03-03T13:05:00.001 Function completed (Success, Id=a5be778e-da6d-4957-a7b5-d9c8f58bd396)
感谢您的阅读.
推荐答案
您需要将机器人输出绑定名称从 "message"
更改为 "$return"
,因为您已经对函数进行了编码,以将消息作为函数返回值而不是作为输出参数返回.这就是警告试图告诉你的.
You need to change your bot output binding name from "message"
to "$return"
since you've coded your function to return the message as a function return value and not as an output parameter. That's what the warning is trying to tell you.
一旦你解决了这个问题,我也相信 "secret"
值应该是一个应用设置名称,其值是你的机器人密码.您不应该将秘密直接放在您的 function.json 文件中.
Once you fix that, I also believe that the "secret"
value should be an app setting name whose value is your bot secret. You shouldn't put the secret directly in your function.json file.
这篇关于Azure 函数不通知我的机器人(机器人框架)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Azure 函数不通知我的机器人(机器人框架)
基础教程推荐
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 如何激活MC67中的红灯 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01