用于APNS的PushSharp在本地服务器上工作,但在azure上不工作
我正在ASP.NET web api服务器中使用push sharp。在我的本地计算机上,一切都像是GCM和APN的魅力,但一旦上传到azure,只有GCM消息起作用。APNS不工作,没有抛出异常。我在推送代理抛出的每个事件中都有跟踪,但没有调用跟踪消息。甚至消息都没有排队 这是我的初始化代码:用于APNS的PushSharp在本地服务器上工作,但在azure上不工作,azure,asp.net-web-api,apple-push-notifications,pushsharp,Azure,Asp.net Web Api,Apple Push Notifications,Pushsharp,我正在ASP.NET web api服务器中使用push sharp。在我的本地计算机上,一切都像是GCM和APN的魅力,但一旦上传到azure,只有GCM消息起作用。APNS不工作,没有抛出异常。我在推送代理抛出的每个事件中都有跟踪,但没有调用跟踪消息。甚至消息都没有排队 这是我的初始化代码: public PushNotificationManager() { _pushService = new PushBroker();
public PushNotificationManager()
{
_pushService = new PushBroker();
_pushService.OnChannelCreated += OnChannelCreated;
_pushService.OnChannelDestroyed += OnChannelDestroyed;
_pushService.OnChannelException += OnChannelException;
_pushService.OnDeviceSubscriptionChanged += OnDeciveSubscriptionChanged;
_pushService.OnDeviceSubscriptionExpired += OnDeviceSubscriptionExpired;
_pushService.OnNotificationFailed += OnNorificationFailed;
_pushService.OnNotificationRequeue += OnNotificationQueued;
_pushService.OnNotificationSent += OnNOtificationSend;
_pushService.OnServiceException += OnServiceException;
InitAndroidPushService();
InitApplePushService();
}
private void InitApplePushService()
{
try
{
string appDataPath = HttpContext.Current.Server.MapPath("~/app_data");
//***** Development Server *****//
//string file = Path.Combine(appDataPath, "PushSharp.PushCert.Development.p12");
//var appleCert = File.ReadAllBytes(file);
// _applePushService = new ApplePushService(new ApplePushChannelSettings(false, appleCert, "XXXXXXX"));
//***** Production Server *****//
string file = Path.Combine(appDataPath, "PushSharp.PushCert.Production.p12");
var appleCert = File.ReadAllBytes(file);
_pushService.RegisterAppleService(new ApplePushChannelSettings(true, appleCert, "XXXXXX"));
Trace.TraceInformation("ApplePushService initialized succesfully");
}
catch (Exception e)
{
Trace.TraceError("Error initializing ApplePushService : " + e);
throw;
}
}
private void InitAndroidPushService()
{
try
{
_pushService.RegisterGcmService(new GcmPushChannelSettings("XXXXXX", "XXXXXX",
"XXXXX"));
Trace.TraceInformation("GooglePushService initialized succesfully");
}
catch (Exception e)
{
Trace.TraceError("Error initializing AndroidPushService : " + e);
}
}
有人遇到过这样的事情吗?你找到解决办法了吗?是的。。。它不起作用,因为我的消息太长。。。我相信上限是256个字符