2013-03-25 117 views
3

因此,我在我的ASP.NET mvc应用程序内部使用了尖锐的内存,并且不断收到连接失败错误。我安装了NUGET软件包以进行快速扫描,因此我无法访问源代码。我花了一段时间才意识到我得到这个错误,因为我没有在调试一段时间。首先在这里是我得到的错误代码。Pushsharp连接失败

类型PushSharp.Apple.ConnectionFailureException的未处理的异常发生在PushShart.Apple.DLL

其它信息:尝试(3)的最大数目来连接gateway.sandbox.push.apple.com: 2195达成了!

这是我用于推送通知的代码。它非常简单。

public int samplePush() 
    { 
     var push = new PushBroker(); 
     var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Certificates1.p12")); 
     var settings = new ApplePushChannelSettings(false, appleCert, "1111"); 
     push.RegisterAppleService(settings); 
     push.QueueNotification(new AppleNotification() 
      .ForDeviceToken("c49e457bc041dead313f43684a42a0acdc8d4393b229db08e2873849a8a2db22") 
      .WithAlert("Test push notification") 
      .WithSound("default") 
      .WithBadge(7)); 
     push.OnNotificationFailed += push_OnNotificationFailed; 
     push.StopAllServices(); 
     return 200; 
    } 

我已经尝试了一些东西,首先我用多个证书包括PEM文件,但没有人给我任何错误,只要无效的证书去。

我也手动打开端口2195允许所有连接,我也尝试过从多个连接,其中之一是我的工作连接,它在过去的推送通知工作。我在这里可能会造成这个问题。

回答

0

它的最后一部分是证书错误。显然要临时复制需要一个新的证书。