c# – PushSharp APNS通知错误不支持请求的功能

c# – PushSharp APNS通知错误不支持请求的功能,第1张

概述我正在使用PushSharp 4.0.10 在Apns代理的OnNotificationFailed事件中,我得到“不支持请求功能”异常.有我的经纪人创建者 private static ApnsServiceBroker CreateApnsBroker(string certificate){ // Configuration (NOTE: .pfx can also be use 我正在使用PushSharp 4.0.10
在Apns代理的OnNotificationFailed事件中,我得到“不支持请求的功能”异常.有我的经纪人创建者

private static ApnsServicebroker CreateApnsbroker(string certificate){    // Configuration (NOTE: .pfx can also be used here)    var config = newApnsConfiguration(        ApnsConfiguration.ApnsServerEnvironment.SandBox,certificate,ConfigurationManager.AppSettings["Cert_Passwd"],false);    // Create a new broker    var apnsbroker = new ApnsServicebroker(config);    // Wire up events    apnsbroker.OnNotificationFailed += (notification,aggregateEx) =>    {        aggregateEx.Handle(ex =>        {            // See what kind of exception it was to further diagnose            if (ex is ApnsNotificationException notificationException)            {                // Deal with the Failed notification                var apnsNotification = notificationException.Notification;                var statusCode = notificationException.ErrorStatusCode;                Logger.Info($"Apple Notification Failed:                    ID={apnsNotification.IDentifIEr},Code={statusCode}",ex);            }            else            {                // Inner exception might hold more useful information                // like an Apnsconnectionexception                Logger.Info($"Apple Notification Failed for some unkNown reason:                    {ex.InnerException}",ex);            }                // Mark it as handled                return true;            });    };    apnsbroker.OnNotificationSucceeded += (notification) =>    {        Logger.Info($"Apple Notification Sent for device {notification.Devicetoken}");    };    return apnsbroker;}

发送通知

private static voID QueueNotification(    ApnsServicebroker apnsbroker,string devicetoken,string payload){    // Queue a notification to send    apnsbroker.QueueNotification(new ApnsNotification    {        Devicetoken = devicetoken,Payload = JObject.Parse(payload),Expiration = DateTime.Now.AddDays(2)    });}

当我在OnNotificationFailed中停止代理时捕获异常.在PushSharp和我的代码中我使用ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
使用.p12证书进行voip通知,它以mmc格式添加
我的错是什么?

解决方法 我克隆PushSharp repo,编译本地dll,更改项目链接,它的工作,但我不知道为什么. 总结

以上是内存溢出为你收集整理的c# – PushSharp APNS通知错误不支持请求的功能全部内容,希望文章能够帮你解决c# – PushSharp APNS通知错误不支持请求的功能所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1233300.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-06
下一篇 2022-06-06

发表评论

登录后才能评论

评论列表(0条)

保存