0
webPushClient.SendNotification(subscriptionkey, JsonData, vapidDetails);

When i am trying to push web notification to browser then i am getting this below exception.

System.AggregateException: One or more errors occurred.
 ---> WebPush.WebPushException: Received unexpected response code 
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) 
   at WebPush.WebPushClient.<SendNotificationAsync>d__15.MoveNext()   
   --- End of inner exception stack trace --- 
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) 
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) 
   at WebPush.WebPushClient.SendNotification(PushSubscription subscription, String payload, VapidDetails vapidDetails) 
   at ServerMonitor.Program.Main(String[] args)
 ---> (Inner Exception #0) WebPush.WebPushException: Received unexpected response code 
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) 
   at WebPush.WebPushClient.<SendNotificationAsync>d__15.MoveNext()<---

but its creating issue production environment,after 48 hours it starts pushing the notification,unable to get where it went after 48 hours it starts working,wrong for the initial 48 hrs

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
  • `unexpected response code`... You need at least to find that HTTP status code. Otherwise it's hard to tell what's going on. – collimarco Oct 18 '17 at 07:13
  • I am getting HTTP status code 400 – Pankaj Verma Oct 20 '17 at 04:19
  • I have seen Google returning `400` also for authentication errors (i.e. wrong VAPID configuration). You should also check the status name returned together with `400` because can be something more specific than `Bad Request`. – collimarco Oct 20 '17 at 08:44
  • maybe Gone = 410 // Equivalent to HTTP status 410. System.Net.HttpStatusCode.Gone indicates that the requested resource is no longer available. – Alex Jan 04 '18 at 10:31

0 Answers0