C# Azure函数没有';t通知我的bot(bot框架)

C# Azure函数没有';t通知我的bot(bot框架),c#,azure,botframework,azure-functions,azure-bot-service,C#,Azure,Botframework,Azure Functions,Azure Bot Service,我使用的是Azure函数(计时器触发函数),它每X分钟执行一次。我已经使用BotFramework创建了一个bot,我希望每x分钟触发一个azure函数。当它被触发时,必须通知我的机器人 为此,我有一个输出机器人框架: 这是我的JSON文件: { "bindings": [ { "name": "myTimer", "type": "timerTrigger", "direction": "in", "schedule": "0 */

我使用的是Azure函数(计时器触发函数),它每X分钟执行一次。我已经使用BotFramework创建了一个bot,我希望每x分钟触发一个azure函数。当它被触发时,必须通知我的机器人

为此,我有一个输出机器人框架:

这是我的JSON文件:

{
  "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:缺少名为“message”的绑定参数。绑定参数名称不匹配可能导致函数索引错误

有了这些东西,Azure功能运行良好,但我的机器人似乎没有得到通知。我忘了什么吗

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)

感谢阅读。

您需要将bot输出绑定名称从
“message”
更改为
“$return”
,因为您已将函数编码为将消息作为函数返回值而不是输出参数返回。这就是警告想要告诉你的


一旦你解决了这个问题,我也相信
“secret”
值应该是一个应用程序设置名称,它的值就是你的bot secret。你不应该直接把秘密放在function.json文件中。

btw:不要从输出菜单中添加密钥(参见上面的我的图片),因为它会自动将密钥添加到你的function.json中。正如@mathewc所说,通过创建一个新条目“AzureWebJobsBotFrameworkDirectLineSecret”将其添加到应用程序设置中对输出绑定很有效,但当作为Bot框架添加输入绑定时,我收到错误
“Message\”:“执行函数时异常:函数。->无法解析属性“BotAttribute.SecretSetting”的值。”