简体   繁体   English

Azure 通知中心 CreateOrUpdateInstallationAsync 未失败,但未创建安装

[英]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.

相关问题 Azure 通知中心设备安装并发送测试消息成功但没有消息发送到应用程序 - Azure notification hub device installation and send test message successful but no messages being sent to the app 有效负载,用于通过Azure通知中心向Windows 10(移动)设备发送推送通知 - Payload for sending push notifications to Windows 10 (mobile) devices with Azure notifcation hub Azure Notification Hub安装不更新标记 - Azure Notification Hub installation not updating tags Azure 上的 POST 数据事件中心失败 - POST data on Azure Event hub is failing Azure IoT 中心在 Ubuntu 上的 Azure IoT Edge 安装中丢失 20.04 - Azure IoT Hub missing in Azure IoT Edge installation on Ubuntu 20.04 Azure苹果推送通知认证 - Azure apple push notifcation certification Azure 通知中心:安装 ID 在中心之间唯一? - Azure Notification Hub: installation id unique between hubs? 使用.net后端安装后,Azure Notification Hub无法反映在门户上 - Azure Notification Hub Not Reflecting on Portal after Installation with .net Backend Azure通知中心推送通知失败或传递无效或不完整的数据 - Azure notifications hub push notification failing or delivering invalid or incomplete data 删除 Azure Functions 正在使用的 Azure IoT 中心消息 - Delete Azure IoT Hub messages being used by Azure Functions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM