2 回答
It turns out there is a bug in the NuGet package for Microsoft.ServiceBus 2.1.2.0 where calling NotificationHubClient.GetAllRegistrations(10) does not correctly retrieve only the top 10 registrations, instead it recursively retrieves ALL registrations in blocks of 10. In my case it turns out there were 250 registrations (most were old), so the API call was being made 25 times in quick succession (~5 seconds) which explains the QuotaExceededException.
The fix was to upgrade to the latest NuGet package for Microsoft.ServiceBus - currently 2.5.2.0.
获取所有注册被视为(并被限制!)作为分析操作。这意味着它不应该在您的主要运行时流程中使用。或者换句话说 - 如果你必须经常调用它,那么就有问题了......
以更详细的方式描述您的应用程序,我很乐意帮助您找出一个好的 NH 使用模式。