通知中心RegistrationAuthorizationException

时间:2016-04-14 10:43:46

标签: azure push-notification windows-phone-8.1 win-universal-app azure-notificationhub

昨天我跟着这个link来接收来自我的Windows 8.1手机应用程序上的azure通知中心的通知,它正在运行但是

但是今天它给我发了这个错误

An exception of type 'Microsoft.WindowsAzure.Messaging.RegistrationAuthorizationException' occurred in mscorlib.ni.dll but was not handled in user code

Additional information: HTTP request failed.



HTTP Details:

Status: 401

Reason: Unauthorized

Full content: <Error><Code>401</Code><Detail>ExpiredToken: .TrackingId:e27f22fb-5c9c-4028-8594-eacb71e5a35e_G1,TimeStamp:4/14/2016 10:29:33 AM</Detail></Error>

当我的应用程序尝试注册时,我在App.xaml.cs中的InitNotificationsAsync方法中抛出此异常

private async void InitNotificationsAsync()
    {
        var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

        var hub = new NotificationHub("nameofhub", "myconnectionstring");
        var result = await hub.RegisterNativeAsync(channel.Uri);

        //Displays the registration ID so you know it was successful
        if (result.RegistrationId != null)
        {
            var dialog = new MessageDialog("Registration successful: " + result.RegistrationId);
            dialog.Commands.Add(new UICommand("OK"));
            await dialog.ShowAsync();
        }

    }

1 个答案:

答案 0 :(得分:0)

你是在模拟器中尝试还是..? 它可以是时间同步。 如果那是模拟器,你可以检查时间并手动设置吗?