Azure 应用服务推送 - 注册端点

Azure App Service Push - registration endpoint

我正在尝试使用 Azure 应用服务推送在 Xamarin iOS 项目上实施推送通知,但我遇到了设备注册失败的问题。

令人困惑的部分是:

我读过https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter5/concepts/ 它基本上说

The /push/installations endpoint is part of App Service Push - a feature of the Azure App Service resource. This exists on your .azurewebsites.net domain. It is not part of Notification Hubs.

然而,根据这个post: https://blogs.msdn.microsoft.com/appserviceteam/2017/01/10/azure-mobile-apps-net-sdk-releases/

.AddPushNotifications()(实际上添加了 /push/installations 端点)现已弃用:

You should use the App Service Push endpoint instead. In your ASP.NET Owin Startup class, you can remove the reference to .AddPushNotifications() from the configuration.

详情在这里: https://github.com/Azure/azure-mobile-apps-net-server/wiki/What-is-a-Default-Configuration%3F

如果我正确理解我的 App Service 移动应用程序,一旦通过通知中心连接到推送应该会公开某种端点以进行设备注册,但我发现不清楚该端点是什么,我是否需要在移动设备中手动创建它后端应用?

.AddPushNotifications() 用于通过上一个包下的 Microsoft.Azure.Mobile.Server.Notifications package, you could check the NotificationInstallationsController.cs 支持 Azure Notification Hubs 推送注册端点。此时,您需要使用通知中心的连接字符串值来指定 Microsoft.Azure.NotificationHubs.ConnectionString 应用程序设置。

虽然App Service Push是Azure Portal提供的一项功能,您需要进入您的应用服务并点击"Settings > Push",然后为您的应用选择您的通知中心,更多细节您可以参考here.

对于您的移动客户端,您可以利用 MobileServiceClientExtensions.cs and the PushHttpClient.cs to send requests against push/installations for you. For more detailed code snippet, you could refer to hereIMobileServiceClient 的扩展方法 GetPush。另外,您可以参考 adrian hall 关于使用 .InvokeApiAsync() 方法的书。