title: Pushsharp send apple notification failed : SSL Stream Failed to Authenticate as Client
body: <p>I trying to send push notification to apple devices using Pushsharp library on ASP.NET MVC project hosted on IIS.</p>
  
  <p>My code :</p>
  
  <pre><code> public static void SendAppleNotification()
          {
              // Configuration (NOTE: .pfx can also be used here)
              byte[] arr = File.ReadAllBytes("D:\\MySoftware\\pa_Dev.pem");
  
              var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox,
       arr, "1234");
  
              // Create a new broker
              var apnsBroker = new ApnsServiceBroker(config);
  
              // Wire up events
              apnsBroker.OnNotificationFailed += (notification, aggregateEx) =&gt; {
  
                  aggregateEx.Handle(ex =&gt; {
  
                      // See what kind of exception it was to further diagnose
                      if (ex is ApnsNotificationException)
                      {
                          var notificationException = (ApnsNotificationException)ex;
  
                          // Deal with the failed notification
                          var apnsNotification = notificationException.Notification;
                          var statusCode = notificationException.ErrorStatusCode;
  
                          Console.WriteLine($"Apple Notification Failed: ID={apnsNotification.Identifier}, Code={statusCode}");
  
                      }
                      else
                      {
                          // Inner exception might hold more useful information like an ApnsConnectionException           
                          Console.WriteLine($"Apple Notification Failed for some unknown reason : {ex.InnerException}");
                      }
  
                      // Mark it as handled
                      return true;
                  });
              };
  
              apnsBroker.OnNotificationSucceeded += (notification) =&gt; {
                  Console.WriteLine("Apple Notification Sent!");
              };
  
              // Start the broker
              apnsBroker.Start();
  
  
                  // Queue a notification to send
                  apnsBroker.QueueNotification(new ApnsNotification
                  {
                      DeviceToken = "660E4433785EFF2B2AA29D5076B039C969F1AADD839D79261328F40B08D26497",
                      Payload = JObject.Parse("{\"aps\":{\"badge\":7}}")
                  });
  
  
              // Stop the broker, wait for it to finish   
              // This isn't done after every message, but after you're
              // done with the broker
              apnsBroker.Stop();
  
  
          }
  </code></pre>
  
  <p>Notes :
  1- Tried to change pem extension into p12 and same issue still occurred.
  2- I tried to send push notification using <a href="https://pushtry.com/" rel="nofollow noreferrer">https://pushtry.com/</a> and its working fine so issue not from certification file or password.</p>
  
  <p>The issue inside pushsharp or there is configurations missing must done on my machine, Any one have idea ?</p>