我正在使用Azure通知服務。Azure通知服務:遠程服務器返回錯誤:(401)未經授權。 ExpiredToken:.TrackingId:
我記錄了我發送給azure的每個推送通知的結果。
我有時得到以下結果/響應:
"The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:f38f2e96-23b9-4c5b-880g-1358c5c15316_G4,TimeStamp:9/1/2016 9:48:14 PM"
我得到像2 - 10在一排在1秒內的空間。然後它再次開始工作。
這裏是我的日誌:
Date Result
2016-09-01 22:07:02.81 Enqueued
2016-09-01 22:07:02.67 Enqueued
2016-09-01 22:05:34.03 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:9bf11f89-9c54-4213-8e42
2016-09-01 22:04:44.52 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:36fb0e8b-7d0f-4145-a125
2016-09-01 22:04:44.51 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:23c76f68-52ca-404a-ad31
2016-09-01 22:04:44.09 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:ceb11915-745a-4924-80cf
2016-09-01 22:04:44.09 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:75c61cba-fadc-4c05-8fe2
2016-09-01 22:03:52.82 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:e3696e3d-a44b-4179-a14a
2016-09-01 22:03:52.82 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:ea3c040b-e358-461b-a56f
2016-09-01 22:03:52.40 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:2eb9901d-e267-4053-a6a4
2016-09-01 22:03:52.40 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:163730b1-b7ef-43e8-adaf
2016-09-01 22:03:51.98 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:f28412c5-262f-4891-b991
2016-09-01 22:03:51.55 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:48b5dc83-ee3a-4d3f-b525
2016-09-01 22:03:51.55 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:a64ce0b1-dd6d-4972-8990
2016-09-01 22:03:51.13 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:b43bde8d-febb-4624-99c6
2016-09-01 22:03:51.13 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:17bd762d-0b4b-450c-bf09
2016-09-01 22:03:50.71 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:9abef735-bf42-4494-9721
2016-09-01 22:03:50.71 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:3f9b9c82-e37e-48c4-931e
2016-09-01 22:03:50.29 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:685a2286-6f0b-4fdf-9dd6
2016-09-01 22:03:50.28 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:3715eee2-b4b6-4ec4-9141
2016-09-01 22:03:49.87 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:91212080-719f-4b95-b9da
2016-09-01 22:03:49.86 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:bd1f5ae4-1a38-40d6-87ba
2016-09-01 22:03:48.01 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:47307851-cd9b-4632-94b6
2016-09-01 22:03:22.07 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:c8a21d16-de82-4fef-b2e
2016-09-01 22:03:22.07 The remote server returned an error: (401) Unauthorized. ExpiredToken: .TrackingId:1fe9246d-19fc-4818-b8a8
2016-09-01 22:03:11.44 Enqueued
2016-09-01 22:03:11.34 Enqueued
那會是什麼錯誤訊息?
[經過一番思考]
難道這是一個線程問題?我實現這個代碼的方式是,每個任務都有一個單例實例NotificationHubClient
,然後調用SendGcmNativeNotificationAsync()
。
可以[時鐘同步](https://social.msdn.microsoft.com/Forums/en-US/bbe5699a-763c-445e-b174-86a55e460c05/notification-hubs-call-registernativeasync-returns-registrationauthorizationization-401 ?forum = notificationhubs)是個問題嗎?如果帖子沒有幫助,你可以分享你的名字空間名稱嗎? –
我不知道?我注意到在401有一個時間戳字段,我注意到它在我的時間戳之前大約5分鐘。 – Zapnologica
這是一個生產部署還是您在模擬器上運行?如果後者,你能確保時鐘被手動設置到正確的時間嗎? –