api net.core 1.1 中的 Azure 通知中心

Azure notifications hubs in api net.core 1.1

我找遍了整个网络,也没有找到任何明确的东西。 我想知道是否可以在使用 net.core 1.1 创建的 api rest 中使用 azure 客户端发送通知。 他们自己的通知应该到达 Azure 门户中配置的平台。

我解释一下我的结构。 1. 我有一个用 net.core 1.1 创建的后端 (api),发布在维护数据库的 azure 中。 2. 我有一个 croos-platform 应用程序,我想获取从 api.

发送的通知

如果可行,请用 asp.net api 表示,但创建我的新 api 和 net.core 并且从这里我无法安装任何 azure 客户端可以发送通知。 (Nuget Microsoft.Azure.notificationHub 与 net.core 不兼容) Package Microsoft.Azure.NotificationHubs 1.0.8 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.Azure.NotificationHubs 1.0.8 supports: net45 (.NETFramework,Version=v4.5) One or more packages are incompatible with .NETCoreApp,Version=v1.1.

有没有人知道可以在其中执行此操作的示例或小指南???

非常感谢

正如 Microsoft Azure Notification Hubs 1.0.8 指出的那样:

Please note that this package requires .Net Framework 4.5 Full Profile.

我找到了关于 Microsoft.Azure.NotificationHubs add support for .NET CORE. I assumed that you could generate the authorization token and directly access the APIs from Notification Hubs REST APIs for a workaround to achieve your purpose. And here is a git sample about azure-notifications Send REST 的反馈,您可以参考它在您的 .Net Core Web API 项目中实现通知服务。

非常感谢您的回复。 但如果你看起来不错,我想要的是在我的 net.core 项目中使用 Azure.notificationsHub。

最后我是通过下面的方式实现的

在我的文件中project.json 首先要改的是框架,必须是下面的方式。 之前

之后

现在可以在您的 net.core 项目中使用任何 nuget 包,等等 Azure.notificationsHub

完成后,您只需创建一个发送通知的方法

希望对遇到同样问题的人有所帮助。我测试并完美地工作。 问候。