使用Azure通知中心发送推送通知(未授权401)

Ron*_*ARP 1 console-application azure azure-notificationhub

我想将推送通知发送到iPhone.如果我从Azure通知中心 - 网站发送消息,它工作正常,但我无法从我的c#控制台应用程序发送通知.

我添加了Microsoft.Azure.NotificationHubs - Nuget Package,

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

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

        Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)

但它引发了一个例外情况"未经授权的401".

我希望有人能提供帮助.关心罗尼

小智 7

var client = NotificationHubClient.CreateClientFromConnectionString ( HUBLISTENACCESS,
Run Code Online (Sandbox Code Playgroud)

问题是LISTENACCESS键没有SendOperations的权限.你可以试试FULLACCESS键吗?