使用NotificationHub Integration

时间:2017-10-25 21:32:01

标签: azure azure-functions azure-notificationhub

我在azure上部署了azure函数时出现错误,其中func无法找到通知中心连接字符串设置。

Error indexing method 'NotifyMobiles.Run'Unable to resolve app setting for property 'NotificationHubAttribute.ConnectionStringSetting'. Make sure the app setting exists and has a valid value.

函数签名如下所示,我得到奇怪的错误,我认为是使用beta库(Microsoft.Azure.NotificationHubs)的结果,并且部署的函数正在寻找具有前缀AzureWebJobs的连接字符串,即使是连接字符串在应用程序设置中命名为SERVICEBUS。因此,我添加了前缀以避免错误,现在发现Service Bus元素但没有Notification Hub

        [FunctionName("NotifyMobiles")]
        public static async Task Run(
            [ServiceBusTrigger("MobileNotifications", AccessRights.Manage, Connection = "SERVICEBUS")] QueueItem queueItem, 
            TraceWriter log,
            [NotificationHub(HubName = "push-notification-hub", ConnectionStringSetting = "NOTIFICATIONHUB", TagExpression = "{Tag}")] IAsyncCollector<Notification> notification)
        {}

enter image description here

1 个答案:

答案 0 :(得分:1)

请删除&#34; AzureWebJobs&#34;来自&#34; NOTIFICATIONHUB&#34;的前缀设置名称。它应与代码中的ConnectionStringSetting值匹配。

您可以删除连接字符串键。