I have an asp.net application that uses the APNs-Sharp libraries to send push notifications. It works fine on my local machine but when i publish to a windows 2008 r2 server machine I get the following error:
System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[] rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx)
at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData, Object password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData, String password)
at JdSoft.Apple.Apns.Notifications.NotificationConnection.start(String p12File, String p12FilePassword)
at JdSoft.Apple.Apns.Notifications.NotificationService.set_Connections(Int32 value)
at JdSoft.Apple.Apns.Notifications.NotificationService..ctor(Boolean sandbox, String p12File, String p12FilePassword, Int32 connections)
I'm not sure why its getting this error only the on the server machine.. Does anyone have any ideas on what the problem could be?
I added a check to my code to see that the certificate file can be found on the server and it is. the password is correct. So the only thing i left i can think of is that it has something to do with with windows server 2008 r2.
found the solution. in iis management console you have to set the default application pools identity to local system.