2015-11-20 96 views
1

我想將推送通知發送到iphone。如果我從Azure通知中心網站發送消息,但是無法從我的c#控制檯應用程序發送通知,它可以正常工作。使用Azure通知中心發送推送通知(未授權401)

我已經加入了Microsoft.Azure.NotificationHubs - NuGet包,

 var client = NotificationHubClient.CreateClientFromConnectionString (HUBLISTENACCESS, HUBNAME); 

     client.SendAppleNativeNotificationAsync (json).ContinueWith (
      t => { 
       Console.WriteLine (t.Result); 
      }); 

     Console.ReadLine(); 

,但它提出了 「未授權401」 異常。

我希望任何人都可以提供幫助。 問候 羅尼

回答

6
var client = NotificationHubClient.CreateClientFromConnectionString (HUBLISTENACCESS, 

的問題是,LISTENACCESS關鍵不具備SendOperations權限。你可以嘗試使用FULLACCESS鍵嗎?

+0

謝謝。它現在有效。問題解決了。這是問題所在。問候 ;) – RonnyCSHARP

相關問題