【发布时间】:2014-10-17 20:29:14
【问题描述】:
我将PushSharp 用于 Apple 推送通知,它在 Windows 8 和 Windows Server 2008R2 上的控制台应用程序和 Windows 服务中运行,但在同一台计算机上传输到 WebApi 应用程序的相同代码不起作用。我已经通过 mmc 在 Personal(私钥可用,授予 IIS_USRS 的权限)和受信任的根证书颁发机构中安装了证书和私钥。 代码有点明显,但以防万一:
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 应用程序中启动时没有收到通知。
【问题讨论】:
标签: ios asp.net-web-api apple-push-notifications pushsharp