NotificationHub推送通知返回:从令牌提供者获得的令牌是错误的 [英] NotificationHub Push Notification returns : The Token obtained from the Token Provider is wrong

查看:202
本文介绍了NotificationHub推送通知返回:从令牌提供者获得的令牌是错误的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Wp8.1 Silverlight应用程序,该应用程序从Mobileservice(旧的Azure服务)接收推送通知(WNS).

I have Wp8.1 Silverlight app that receives push notification (WNS) from Mobileservice (the old azure service).

因此,由于新功能,我想更新到新服务.我现在已经创建/升级了新服务器以使用App Service-Mobile App.并通过Azure的示例应用测试了推送通知(一切正常).

I therefore wanted to update to the new service because of the new features. I have now created/upgraded a new server to use App Service - Mobile App. And tested push notification with the sample app from azure (everything works).

回到我的应用程序WP8.1->通过NuGet(2.0.1)添加新程序包Microsoft.Azure.Mobile.Client,存在Microsoft.WindowsAzure.Mobile.Ext不包含"GetPush"扩展名的问题.好像它不见了吗?展望WP8版本,它仅注册到MPNS,我需要WNS.因此,我不知道是否可以使用任何其他程序集.

Going back to my app WP8.1 -> Adding the new package Microsoft.Azure.Mobile.Client through NuGet (2.0.1), there is the issue that the Microsoft.WindowsAzure.Mobile.Ext does not contain the 'GetPush' extension. It seems like it is missing it? looking to the WP8 version, it only registers to MPNS, and I need WNS. So I do not know if any other assembly could be used.

我可以添加另一个程序集引用吗?

Can I add another assembly reference?

更新

以下代码使我可以在服务器上注册设备,并且可以看到该设备已正确注册.客户端检索channelUriinstallationInformation并将其发送到服务器的地方.

The following code lets me register the device on the server, and I can see the device register correctly. where the channelUri and the installationInformation are retrieved by the client and send to the server.

Installation ins = new Installation();
ins.Platform = NotificationPlatform.Wns;
ins.PushChannel = uTagAndChan.ChannelUri;
ins.Tags = uTagAndChan.Tags;
ins.InstallationId = uTagAndChan.installationInformation;
await hubClient.CreateOrUpdateInstallationAsync(ins);

向注册标签发送测试吐司通知会导致以下错误:

Sending a test toast-notification to the registered tags, results in the following error :

从令牌提供者获得的令牌是错误的

The Token obtained from the Token Provider is wrong

在搜索此问题时,我发现 Windows应用商店推送通知通过Azure服务总线.提议的解决方案说要直接从该应用程序注册到通知中心,我宁愿该应用程序不能直接访问该中心.但这是唯一的方法吗? (请注意,答案没有被接受,尽管它不是理想的解决方案,但我会尽一切努力)

Searching on this issue I found Windows Store App Push Notifications via Azure Service Bus. Which the proposed solution says to register to the notification hub directly from the app, I would rather not have the app to have directly access to the hub. But is this the only way? (mind you the answer was not accepted, but I will try it all though it is not a desired solution)

更新

通过客户端注册通知(WP8.1 Silverligt),向MPNS进行注册,这是我所不希望的.

Registering for notifications via client (WP8.1 Silverligt), makes a registration to MPNS, which I do not want.

服务器上的代码段注册了一个WNS,这两个注册可以在此处看到:

The snippet on the server registers a WNS, the two registrations can be seen here:

使用

var channel = await Windows.Networking.PushNotifications.PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

在说明中指出它返回WNS.这似乎可以推断出我正在服务器上进行的注册(顶部的代码段)是正确的,而客户端上的注册是错误的.

which in the description states it returns a WNS. This seems to infer that the registration I am doing on the server (code snippet in the top) is correct and the registration on the client is faulty.

但是图像上的配准似乎是错误的.两个注册的PNS Identifier不应不同吗?还expiration date似乎错了吗?

But the registration on the image seems wrong. Shouldn't the PNS Identifier be different for the two registrations? also expiration date seems wrong ?

由于NuGet软件包中不存在GetPush()(示例中可用的为客户端正确注册以进行通知),该如何解决?

How to mend this since the GetPush() (which was available in the sample registered the client correctly for notifications) does not exist in the NuGet package?

更新

我读到一个地方,删除和重新创建NotificationHub可能会有所帮助.我今天将尝试.即使成功,更希望有解决方案,并知道注册是否正确完成了?

I read one place that deleting and recreating the NotificationHub could help. I will try this today. Even IF it works, it would be more desirable to have the solution, and to know if the registrations are done correctly?

临时解决方案:

Deltede,重新创建,插入程序包SID"和秘密".而且它再次起作用(奇怪)!

Deltede, recreated, inserted Package SID and Secret. And it works again (strange)!

仍然对潜在问题感兴趣!

Still interested in the underlying issue!

推荐答案

删除并重新创建该服务,并设置所有相同的设置即可使其再次正常工作.

Deleted and recreated the service, setting all the same settings made it work again.

这篇关于NotificationHub推送通知返回:从令牌提供者获得的令牌是错误的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆