Error in PushSharp: The maximum number of Send attempts to send the notification was reached

We are using PushSharp to implement push messaging for Apple devices in an app, and we are running into an issue which is very similar to

Issue #204: Max Send Attempts Reached And Then Certificate Error

and

Failure: PushSharp.Apple.ApplePushService -> The maximum number of Send attempts to send the notification was reached.

The error messages we are receiving are the same: for each queued message we get "{"aps":{"alert":"testing","badge":1}}, message: The maximum number of Send attempts to send the notification was reached!" in PushSharp.Apple.ApplePushService. Then after the queue is being emptied, we get the "The credentials supplied to the package were not recognized" error with following stacktrace:

at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc)    
at System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse credUsage, SecureCredential& secureCredential)    
at System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]& thumbPrint)    
at System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]& output)    
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)    
at PushSharp.Apple.FeedbackService.Run(ApplePushChannelSettings settings, CancellationToken cancelToken)    
at PushSharp.Apple.ApplePushService.<ApplePushService>c__AnonStorey3.<>m__8(Object state)

This message will reappear every 10 minutes.

I have tried using different settings for the AutoScale option, and so on, like this:

push.RegisterAppleService(new ApplePushChannelSettings(true, appleCert, "xxxx"), new PushServiceSettings() { AutoScaleChannels = false, Channels = 1, MaxAutoScaleChannels = 1, MaxNotificationRequeues = 2, NotificationSendTimeout = 5000 });

This didn't work either.

We have tried regenerating our certificate with Apple, but no luck yet. The strange thing is: when we use the PushSharp code from a console application on the same server, all is fine and the push notifications are received on our test devices. But when we implement the code into an event receiver on the same server, we get the above mentioned errors. By event receiver I mean a Sharepoint event receiver. We have a VM in Azure where SharePoint is installed. From inside the same VM a console app with the same code and certificates does work. I'm guessing it could be something related to Azure or SharePoint, but for the life of me cannoy figure it out. The code is inside a dll that is deployed to the GAC.

Any help would be greatly appreciated!

Sign In or Register to comment.