【发布时间】:2014-03-18 03:11:30
【问题描述】:
我一直在使用 ASP.NET 和 PushSharp 使用以下简单代码(在证书配置等之后)向我的 iOS 应用程序客户端发送推送通知:
//ASP.NET + PushSharp
AppleNotification notification = new AppleNotification(PushToken).WithAlert(message);
broker.QueueNotification<AppleNotification>(notification);
这在运行经典 IIS/ASP.NET 的隔离主机上非常有效,但现在我正在转向 Windows Azure。当我在 Windows Azure 上尝试此代码时,通知有时无法发送,重新启动网站(标准模式)会有所帮助。但是,由于这是一种不可靠的方法,我决定迁移到 Azure 的 Notification Hub 服务。我已经创建了集线器,上传了我的证书,开始编码,但我找不到与我之前的代码等效的东西。我不需要向所有用户广播消息,我需要向单个设备发送推送通知,因为我有推送令牌。我看过Windows Azure ServiceBus Push Notifications APNS Architecture,但答案中提供的链接非常混乱,我无法理解。我怎样才能简单地将消息推送到 Windows Azure 上的推送令牌?我必须使用通知中心吗? (我不使用 VM)欢迎使用任何简单的方法,首选基于 ASP.NET/PushSharp 的方法,因为我不需要更改整个代码库。
【问题讨论】:
标签: asp.net azure apple-push-notifications pushsharp azure-notificationhub