[英]Azure Notifcation Hub CreateOrUpdateInstallationAsync not failing but Installation not being created
I have an ASP.NET Web Api that is registering Android and iOS installations in our Azure Notification Hub. I have an ASP.NET Web Api that is registering Android and iOS installations in our Azure Notification Hub. It creates a HubClient using a connection string
它使用连接字符串创建 HubClient
this.azureHub = NotificationHubClient.CreateClientFromConnectionString(
"Endpoint=sb://OUR-HUB-NS.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=tK/SEXXXXXXXXXXX/7LUtvRoNt+HjToFmP+T++yW5g=",
"OUR-HUB");
We then create an installation using this code然后我们使用此代码创建安装
try
{
await azureHub.CreateOrUpdateInstallationAsync(installation, token);
}
catch(Exception e)
{
this.logger.LogError(e, "CreateOrUpdateInstallationAsync failed with" + e.Message);
return false;
}
return true;
When I had the NoticationHubClient incorrectly configured I was getting 401 errors and if I pass in nonsense for the installation data I will get a 400. Currently the call does not throw an error so I asm going to assume what I am passing is correct and it can successfully connect to the hub.当我的 NoticationHubClient 配置不正确时,我收到 401 错误,如果我为安装数据输入废话,我将收到 400。目前该调用不会引发错误,所以我假设我传递的内容是正确的并且它可以成功连接到集线器。 However registrations are not being created.
但是没有创建注册。 If i try and get the installation after it is created with
如果我在创建后尝试安装
GetInstallationAsync(installation.InstallationId)
I get an error saying the installation cannot be found and if I try and get all registrations i get an empty list我收到一条错误消息,提示找不到安装,如果我尝试获取所有注册,我会得到一个空列表
var registrations = await azureHub.GetAllRegistrationsAsync(0);
Further confirmation that my installations are not being created is that if I use the "Test Send" in Azure Portal I get "Message was successfully sent, but there were no matching targets ."进一步确认我的安装没有被创建是,如果我在 Azure 门户中使用“测试发送”,我会得到“消息已成功发送,但没有匹配的目标”。 for either Apple or Android platform
适用于 Apple 或 Android 平台
What is happening to my registration?我的注册怎么了?
I recreated the Notification Hub with a different name, in the same namespace and everything just started working.我在同一个命名空间中用不同的名称重新创建了通知中心,一切都刚刚开始工作。
I then recreated the non-working hub in Azure Portal and it now all works.然后我在 Azure Portal 中重新创建了非工作集线器,现在一切正常。
All I can say is that I had previously deleted the hub using the OSS Service Bus Explorer and perhaps that deleted the hub in a way that Azure didn't like.我只能说,我之前使用 OSS服务总线资源管理器删除了集线器,并且可能以 Azure 不喜欢的方式删除了集线器。
Not the answer I was expecting.不是我期待的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.