2

使用 Apple 推送通知提供程序 (apns-sharp) 时,我收到以下异常。

推送通知在我的开发机器上工作,但在 Rackspace 云托管中不起作用。我有与我的开发人员一起运行的确切 Rackspace Cloud 自定义中等信任配置。机器,所以中等信任在这里不是问题。此外,证书文件也不是问题,因为它适用于我的开发人员。机器。

有任何想法吗?

更新 #1:这是否与可能不在Rackspace 云服务器上的 Entrust 根服务器有关?我检查了 apns-sharp 代码,看起来它忽略了证书验证,但我不是 100% 确定。

The credentials supplied to the package were not recognized    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.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count)
  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.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
  at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
  at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, 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.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
  at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
  at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, 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.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
  at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
  at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, 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 System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
  at JdSoft.Apple.Apns.Notifications.NotificationConnection.OpenSslStream()
  at JdSoft.Apple.Apns.Notifications.NotificationConnection.Reconnect()
  at JdSoft.Apple.Apns.Notifications.NotificationConnection.workerMethod()
4

4 回答 4

2

这有帮助吗?

于 2010-01-19T16:13:45.473 回答
1

对于继续出现此异常的人:

我有同样的例外,阅读“apns-sharp”中的所有程序和论坛并没有帮助。从 MAC 导出证书一切都很好,我的问题是,当我使用默认配置在本地机器上安装证书时,由于未导入privateKey ,因此无法使用该证书。然后当你打开一个新的证书来安装它时,你应该确保安装了私钥。在代码中,您应该具有以下内容:

new X509Certificate2(rawCertificateInBytes, Password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet);

这解决了我的问题。

于 2012-01-31T02:50:47.193 回答
0

您是否关注此页面: http ://code.google.com/p/apns-sharp/wiki/HowToCreatePKCS12Certificate

此外,您可能有兴趣查看最新版本的 apns-sharp。它解决了许多问题。

于 2010-01-22T11:41:03.657 回答
0

在我的情况下,这个问题与我无法解决的 Rackspace 云站点上的中等信任安全性有关。为了克服这个问题,我将设计更改为使用 PHP 代码来访问 APNS。

于 2011-04-21T05:36:07.453 回答