为什么Azure Notification Hub标记不保存? [英] Why are Azure Notification Hub tags not saving?
问题描述
我正在尝试向通知中心发送消息,但我的标签未保存.
我使用服务中心浏览器检查了服务中心,并且标签为空:
设备注册:
var hs = new HashSet< string>();hs.Add(tag);hs.Add(sys.ToString());开关(sys){案例SystemVendorEnum.Android:等待Hub.CreateGcmNativeRegistrationAsync(pnsHandle,hs);休息;案例SystemVendorEnum.Ios:等待Hub.CreateAppleNativeRegistrationAsync(pnsHandle,hs);休息;}
将消息发送到集线器的测试方法调用:
//param1:json有效负载,param2:标签等待Hub.SendGcmNativeNotificationAsync("{\" data \:{\" methodId \:\" 1 \}}","ae65d2d5-103e-4023-a784-c5c8e2684db0");
我有什么想念的吗?我在通知中心没有标签:
是这样吗?
我知道,这很令人困惑,但是有两种完全独立的标签,彼此之间没有任何关系:
- Azure Notification Hub服务上下文中的标记.这些适用于设备注册.因此,它是特定于通知中心 service 的设备,并描述了设备.有关更多详细信息,请参见
如果您转到Azure门户并导航到任何资源(或者,如您所愿,则导航到集线器),则将在那里看到ARM标记(即第二种标记"):
I am trying to send a message to notification hub, but my tags are not saving.
I checked service hub with service hub explorer, and tags are empty:
Registration of device:
var hs = new HashSet<string>(); hs.Add(tag); hs.Add(sys.ToString()); switch (sys) { case SystemVendorEnum.Android: await Hub.CreateGcmNativeRegistrationAsync(pnsHandle, hs); break; case SystemVendorEnum.Ios: await Hub.CreateAppleNativeRegistrationAsync(pnsHandle, hs); break; }
Test method invocation that sends message to hub:
// param1: json payload, param2: tag await Hub.SendGcmNativeNotificationAsync("{ \"data\": { \"methodId\":\"1\" }}", "ae65d2d5-103e-4023-a784-c5c8e2684db0");
Is there anything I am missing? I don't have tags in notification hub:
Is that the case?
解决方案I know, it's confusing, but there're two completely separate kinds of tags that have have no relationship to each other whatsoever:
- Tags that are within the context of Azure Notification Hub service. Those apply to device registrations. So, it's Notification Hubs service-specific and describes devices. See Routing and Tag Expressions for more details.
- Tags that as a concept of Azure Resource Manager (ARM). Those apply to any resource within Azure. So it's platform-specific and are used to describe any resource/service you have within Azure. See Using tags to organize your Azure resources for more details.
So when you call
hs.Add(tag)
, the associated tags apply to the device registration (i.e. 'tags of the first kind') and should show up in the Service Bus explorer:And if you go to Azure portal and navigate to any resource (or as you did, to your hub), you'll see ARM tags there (i.e. 'tags of the second kind'):
这篇关于为什么Azure Notification Hub标记不保存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!