我這個link昨天跟隨收到關於我的Windows 8.1手機應用程序從蔚藍的通知中心通知,這是工作,但通知中心RegistrationAuthorizationException
但今天是扔我這個錯誤
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();
}
}
您在Azure上使用哪種服務?如果它是您正在使用的新App Store容器,那麼您應該按照以下步驟操作:https://azure.microsoft.com/zh-CN/documentation/articles/app-service-mobile-windows-store-dotnet-get-開始推/ – JTIM