Azure 通知中心和获取注册的问题

问题描述 投票:0回答:0

目前使用 Azure 通知中心发送推送通知。 当从我们的 API 调用 NotificationHub-Client GetRegistrationsByChannelAsync 时,它失败并出现 TaskCanceledException。在该服务运行数月后开始出现这种情况。 我可以在 Azure 服务(中心)中看到 dailyMaxActicDevices 属性经常更新,就像它撞到屋顶一样。通过这项服务的基本订阅,我们远未达到注册设备总数的限制。

有人知道导致此错误的原因吗?我还没有发现任何类似的问题被报告。

无论如何,这是堆栈跟踪:

System.Threading.Tasks.TaskCanceledException:任务被取消。 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 Microsoft.Azure.NotificationHubs.NotificationHubClient.d__201.MoveNext() --- 从抛出异常的先前位置开始的堆栈跟踪结束 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 Microsoft.Azure.NotificationHubs.NotificationHubClient.d__200.MoveNext() --- 从抛出异常的先前位置开始的堆栈跟踪结束 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 Microsoft.Azure.NotificationHubs.NotificationHubClient.d__192`1.MoveNext() --- 从抛出异常的先前位置开始的堆栈跟踪结束 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

报错抛出异常的代码如下:

if (handle != null)
{
var registrations = await hub.GetRegistrationsByChannelAsync(handle, 100);

foreach (RegistrationDescription registration in registrations)
{
if (newRegistrationId == null)
{
newRegistrationId = registration.RegistrationId;
}
else
{
await hub.DeleteRegistrationAsync(registration);
}
}
}

还没有对代码做任何改动,因为这个问题不是一直都出现,只是最近变多了。 我已经检查了 NotificationHub 是否有任何报告的问题,但没有找到任何问题。

azure push-notification azure-notificationhub notificationhubclient
© www.soinside.com 2019 - 2024. All rights reserved.