问题描述
我可以使用succeffully通过沙箱APNS服务器推送夏普但我有一个问题,将通知发送到我的iPhone设备。
I can send notifications to my iPhone device succeffully using Push Sharp via sandbox APNS server but I am having a problem.
我已经生成.CER或.p12文件,然后安装了他们对我的Windows 8的开发机成功。
I have generated .cer and .p12 files and then installed them on my windows 8 development machine successfully.
我用<一个href=\"http://arashnorouzi.word$p$pss.com/2011/04/13/sending-apple-push-notifications-in-asp-net-%E2%80%93-part-3-apns-certificates-registration-on-windows/\"相对=nofollow>这个教程,在我的Windows安装证书8机器。
I used this tutorial to install the certificates on my windows 8 machine.
昨天事情做工精细,我成功地发送通知。关闭我的系统,然后第二天,当我尝试运行code我得到以下异常:
Yesterday things were working fine and I was sending the notification successfully. I shutdown my system and then next day when I try to run the code I was getting following exception:
该消息是意外或格式pushsharp
我试着用不同的解决方案,在谷歌,但没有任何帮助。然后,我删除我的机器证书,然后重新安装它们,事情开始重新工作。
I tried different solution available on Google but nothing helped. Then I delete the certificates from my machine and then re-install them and things started to work again.
为了使服务傻瓜证明我关闭系统,以检查是否通知发送失败或没有,是的,它具有相同的异常再次失败。
In order to make the service fool proof I shutdown the system to check if notification sending fails or not, and yes it fail again with the same exception.
我再次删除证书并重新安装它们,以解决此问题。我不知道什么实际工作的问题?是什么让PUSHSharp停止关机后发送通知。
I again deleted the certificates and re-install them to correct the issue. I do not know whats the actuall problem? what makes PUSHSharp to stop sending notification after shutdown.
注意:Windows firwall被禁用。
任何想法?
Note: Windows firwall is disabled.Any idea?
推荐答案
我一直在PushSharp工作在过去的几个星期,都没有这个问题。我的环境是Windows 7不过。你已经创建了一个iPhone开发者计划门户网站相应的推送通知证书后,您应该已经下载了一个名为类似apn_developer_identity.cer文件。如果你还没有这样做的话,你应该打开/导入此文件到钥匙扣,到你的登录部分。
I have been working with PushSharp for the past few weeks and have not had this problem. My environment is Windows 7 however. After you've created the appropriate Push Notification Certificate in iPhone Developer Program Portal you should have downloaded a file named something like apn_developer_identity.cer. If you have not done so already, you should open/import this file into Keychain, into your login section.
最后,如果您筛选钥匙扣,以显示您的登录容器的证书,您将看到您的证书中列出。展开证书,应该有一个关键的下方/连接到它。
Finally, if you filter Keychain to show your login container's Certificates, you should see your Certificate listed. Expand the certificate, and there should be a Key underneath/attached to it.
右键点击或Ctrl +单击相应的证书,并选择导出。钥匙扣会要求你选择一个密码导出到。选择一个,并记住它。您应该结束了以.p12文件。您将需要该文件和密码,您选择在这里使用的通知和反馈库。
Right Click or Ctrl+Click on the appropriate Certificate and choose Export. Keychain will ask you to choose a password to export to. Pick one and remember it. You should end up with a .p12 file. You will need this file and the password you picked to use the Notification and Feedback Libraries here.
的OpenSSL
下面是如何使用开放SSL,您将需要您的开发者的私有密钥(可以从钥匙串导出)和CertificateSigningRequest ??创建一个PKCS12格式的文件。certSigningRequest
Here is how to create a PKCS12 format file using open ssl, you will need your developer private key (which can be exported from the keychain) and the CertificateSigningRequest??.certSigningRequest
-
转换apn_developer_identity.cer(DER格式)为PEM:
OpenSSL的X509 -in apn_developer_identity.cer -inform DER退房手续apn_developer_identity.pem -outform PEM}
Convert apn_developer_identity.cer (der format) to pem:openssl x509 -in apn_developer_identity.cer -inform DER -out apn_developer_identity.pem -outform PEM}
接下来,转换为PEM P12私钥(最少需要4个字符输入的密码):
OpenSSL的PKCS12 -nocerts退房手续private_dev_key.pem -in private_dev_key.p12
Next, Convert p12 private key to pem (requires the input of a minimum 4 char password):openssl pkcs12 -nocerts -out private_dev_key.pem -in private_dev_key.p12
(可选):如果你想从私有密钥删除密码:
OpenSSL的RSA退房手续private_key_noenc.pem -in private_key.pem
(Optional): If you want to remove password from the private key:openssl rsa -out private_key_noenc.pem -in private_key.pem
拿证书和密钥(有或没有密码),并创建一个PKCS#12格式文件:
OpenSSL的PKCS12 -export -in apn_developer_identity.pem -inkey private_key_noenc.pem -CertFile CertificateSigningRequest ?? certSigningRequest -nameapn_developer_identity退房手续apn_developer_identity.p12
Take the certificate and the key (with or without password) and create a PKCS#12 format file:openssl pkcs12 -export -in apn_developer_identity.pem -inkey private_key_noenc.pem -certfile CertificateSigningRequest??.certSigningRequest -name "apn_developer_identity" -out apn_developer_identity.p12
一旦你使用以下步骤生成P12文件,你不会真的需要把它捕捉到您的控制台。你只需要在你的code变化如下:
Once you generate the p12 file using these steps you will not really need to snap it to your console. You will just need to make changes in your code as follows:
var appleCert = File.ReadAllBytes("C:/Certificate/aps_dev_identity.p12");
希望这有助于。
Hope this helps.
这篇关于PushSharp APNS服务停止窗口关闭后工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!