2013-03-25 118 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

它的最後一部分是證書錯誤。顯然要臨時複製需要一個新的證書。