我使用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