APNs-sharp 库无法在 Windows Server 2008 上运行,CryptographicException

发布于 2024-11-14 06:58:02 字数 1211 浏览 4 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

于我来说 2024-11-21 06:58:02

找到了解决方案。在iis管理控制台中,您必须将默认应用程序池标识设置为本地系统。

found the solution. in iis management console you have to set the default application pools identity to local system.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文