APNs-sharp 库无法在 Windows Server 2008 上运行,CryptographicException
我有一个 asp.net 应用程序,它使用 APNs-Sharp 库发送推送通知。它在我的本地计算机上工作正常,但是当我发布到 Windows 2008 r2 服务器计算机时,我收到以下错误:
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)
我不确定为什么它只在服务器计算机上收到此错误。有谁知道什么是问题可能是?
我在代码中添加了一个检查,以查看是否可以在服务器上找到证书文件,而且确实如此。密码正确。所以我唯一能想到的是它与windows server 2008 r2有关。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了解决方案。在iis管理控制台中,您必须将默认应用程序池标识设置为本地系统。
found the solution. in iis management console you have to set the default application pools identity to local system.