我使用PushSharp蘋果推送通知推送通知並從控制檯應用程序和窗口服務工作在Windows 8和Windows Server 2008 R2,而是轉移到的WebAPI應用程序相同的計算機上相同的代碼無法正常工作。我已經在Personal中通過mmc安裝了證書和私鑰(私鑰可用,授予了IIS_USRS的權限)和受信任的根證書頒發機構。 代碼,但以防萬一是那種顯而易見的:蘋果公司的WebAPI應用
var push = PushBroker();
var appleCert = File.ReadAllBytes("C:\Users\Documents\Certificates\Push.p12");
push.RegisterAppleService(new PushSharp.Apple.ApplePushChannelSettings(false, appleCert, "pwd"));
PushSharp.Apple.AppleNotification notif = new PushSharp.Apple.AppleNotification()
.ForDeviceToken("xxx")
.WithAlert("Updated...")
.WithBadge(1)
.WithSound("default");
push.QueueNotification(notif);
//Wait for queue to finish
push.StopAllServices(true);
沒有錯誤/異常等,它只是iPhone的設備沒有出現在的WebAPI應用程序啓動時得到通知。
貌似[http://stackoverflow.com/questions/23115394/pushsharp-apple-the-message-received-was-unexpected-or-badly-formatted]包含了答案。更新PushSharp到2.2.1問題解決之後。 – 2014-11-20 04:28:36
好消息!幾天後,我將在服務器和客戶端上發佈一個完整的PushSharp演示實現的git回購,我將在這裏發佈它,以便日後查看。 – 2014-11-21 14:52:07