NotificationHubUnauthorizedException:在Azure通知中心登记未经授权 [英] NotificationHubUnauthorizedException: Unauthorized on Azure Notification Hub registration
问题描述
所以我想在Azure上的通知中心。
So I'm trying the Notification Hubs on Azure.
我已经根据设置的东西,<一个href=\"http://weblogs.asp.net/scottgu/archive/2013/06/14/windows-azure-major-updates-for-mobile-backend-development.aspx\"相对=nofollow>这个博客帖子。
我也做了GCM设置在我的Android code,所以我有一个有效的REGID:
I have set things up according to this blog post. I have done the GCM setup in my Android code so I have a valid regId:
String connectionString = "Endpoint=sb://<MYNAMESPACE>.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=<MYKEY>";
hub = new NotificationHub("<MYHUB>", connectionString, this);
hub.register(regid, "myTag");
所以我得到:
com.microsoft.windowsazure.messaging.NotificationHubUnauthorizedException:
未经授权
com.microsoft.windowsazure.messaging.NotificationHubUnauthorizedException: Unauthorized
在hub.register方法调用。
on the hub.register method call.
任何想法?
推荐答案
不幸的是,在一个破坏NH授权规则的管理门户的错误。它会很快得到解决。在此期间,你可以从一个控制台应用程序一个新的NH和服务总线preVIEW dll的具有以下code:
Unfortunately there is a bug in the management portal that corrupts a NH authorization rules. It will be solved very soon. In the meantime, you can create a new NH from a Console App and Service Bus preview dll with the following code:
NamespaceManager mgr = NamespaceManager.CreateFromConnectionString("<connection string from your namespace>");
var hub = new NotificationHubDescription("myhub");
hub.GcmCredential = new GcmCredential("<your Google API Key>");
mgr.CreateNotificationHub(hub);
请务必使用按以下方式从门户获得的连接字符串:
1)在左侧窗格中,单击服务总线
2)在右侧窗格中,选择您的命名空间,然后单击连接信息
3)复制连接字符串的RootAccess,如下图所示:
Make sure to use the connection string retrieved from the portal in the following way: 1) Click Service Bus on the left pane 2) On the right-pane, select your namespace, then click Connection Information 3) Copy the Connection String for RootAccess, as shown below:
很抱歉给您带来的不便。
Sorry for the inconvenience.
这篇关于NotificationHubUnauthorizedException:在Azure通知中心登记未经授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!