Azure通知中心:SendTemplateNotificationAsync是否适用于.net核心

Azure通知中心:SendTemplateNotificationAsync是否适用于.net核心,azure,push-notification,notifications,.net-core,Azure,Push Notification,Notifications,.net Core,我正在.Net核心项目中使用Azure通知中心的预览版本。在我们的服务器上,我让它安装通知中心的设备。我可以设法在后端将设备安装到通知中心,并能够通过门户向iOS设备发送测试 我试图在后端代码中添加一行 [HttpPost] [Route("TestMessage")] public async Task<IActionResult> NotifyByTemplate([FromBody] ApiAttendanceModel model) {

我正在.Net核心项目中使用Azure通知中心的预览版本。在我们的服务器上,我让它安装通知中心的设备。我可以设法在后端将设备安装到通知中心,并能够通过门户向iOS设备发送测试

我试图在后端代码中添加一行

[HttpPost]
    [Route("TestMessage")]
    public async Task<IActionResult> NotifyByTemplate([FromBody] ApiAttendanceModel model)
    {
        //string jsonMessage, IDictionary<string, string> additionalProperperties, string tagExpressions
        var additionalProperties = new Dictionary<string, string>();
        additionalProperties.Add(Constants.Constant.NotificationMsgName, "asdf");
        var hub = NotificationHubClient.CreateClientFromConnectionString(Constants.Constant.NotificationConnectionString, Constants.Constant.NotificationHubName);
        var result = hub.SendAppleNativeNotificationAsync("{'aps':{ 'alert':'Notification hub test notification' }}");//await hub.SendTemplateNotificationAsync(additionalProperties);

        return Ok(true);
    }
[HttpPost]
[路由(“测试消息”)]
公共异步任务NotifyByTemplate([FromBody]APIAtendanceModel模型)
{
//字符串jsonMessage、IDictionary附加属性、字符串标记表达式
var additionalProperties=新字典();
Add(Constants.Constant.NotificationMsgName,“asdf”);
var hub=NotificationHubClient.CreateClientFromConnectionString(Constants.Constant.NotificationConnectionString,Constants.Constant.NotificationHubName);
var result=hub.sendappletativenotificationasync(“{'aps':{'alert':'Notification hub test Notification'}”);//等待hub.SendTemplateNotificationAsync(附加属性);
返回Ok(true);
}
我甚至使用了hub.SendTemplateNotificationAsync。没有收到通知


我想知道推送通知的预览版本是否适用于.NETCore

我知道您没有在等待hub.sendappletivenotificationasync。 这可能会导致方法在发送通知之前返回,而您失去了上下文