简体   繁体   English

Azure Notification Hub安装不更新标记

[英]Azure Notification Hub installation not updating tags

I am attempting to update the tags of an installation within Azure Notification Hub after registration. 我试图注册更新Azure Notification Hub中的安装标签。 I am following several guides for this, notably here and here . 我正在关注这方面的几个指南,特别是在这里这里

Both of these guides suggest that the following code should work however it is plainly not; 这两个指南都表明以下代码应该可行,但显然不是这样; the tag never gets updated. 标签永远不会更新。 There are no errors, and I can guarantee that the installationId is correct. 没有错误,我可以保证installationId是正确的。 I am guessing I am setting the path/value of the tag incorrectly. 我猜我正在错误地设置标签的路径/值。

// in constructor:
var _notificationHub = NotificationHubClient.CreateClientFromConnectionString(Settings.ConnectionStrings.NotificationHub, Settings.Defaults.NotificationHubName);


// in WebApi endpoint:
var installationUpdates = new List<PartialUpdateOperation>();
var userDetail = _userDetailRepo.Get(id);

installationUpdates.Add(new PartialUpdateOperation
{
    Operation = UpdateOperationType.Replace,
    Path = "/tags/interestedin", // is this incorrect?
    Value = interestedIn.ToUpper()
});
userDetail.InterestedIn = interestedIn;

await Task.WhenAll(
    _userDetailRepo.InsertOrReplace(userDetail),
    _notificationHub.PatchInstallationAsync(installationId, installationUpdates));

Here is the installation object's tags, as per VS: 这是安装对象的标签,根据VS:

在此输入图像描述

I also tried hardcoding the path to Path = "/tags/interestedin:W" but it made no difference. 我也试过将路径硬编码到Path = "/tags/interestedin:W"但没有区别。

Can someone tell me if I am doing something wrong here, and if so how I should amend my code. 有人可以告诉我,如果我在这里做错了,如果是的话,我应该如何修改我的代码。 Thanks. 谢谢。

Unfortunately, Path = "/tags/interestedin" is not going to work as of now. 不幸的是, Path =“/ tags / interestin”目前无法运行。 We are currently working on wildcards' support. 我们目前正致力于通配符的支持。 Once it is done, something like "/tags/interestedin*" will work fine for you. 一旦完成,像“/ tags / interestedin *”这样的东西将适合您。

While Path = "/tags/interestedin:W" should be OK. Path =“/ tags / interestin:W”应该没问题。 If you could provide namespace name, hub name, and a timeframe, then I'll take a look at logs to check what is going on there. 如果您可以提供命名空间名称,集线器名称和时间范围,那么我将查看日志以检查那里发生了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM