PushSharp を使用してアプリにプッシュ通知を送信しようとしています。私は 2 つの Apple アカウントを持っています... 1 つは通常のアカウントで、もう 1 つは Enterprise アカウントです。通常のアカウントでは開発者証明書が機能しますが、開発証明書と配布証明書の両方が Enterprise アカウントからは機能しません。認証例外が発生します..
A call to SSPI failed, see inner exception.
Inner Exception:
[System.ComponentModel.Win32Exception]: {"An unknown error occurred while processing the certificate"}
これは、PushSharp の次のコードで発生します (この行はコメントアウトしませんでした)。
try
{
stream.AuthenticateAsClient(this.appleSettings.Host, this.certificates, System.Security.Authentication.SslProtocols.Ssl3, false);
//stream.AuthenticateAsClient(this.appleSettings.Host);
}
catch (System.Security.Authentication.AuthenticationException ex)
{
throw new ConnectionFailureException("SSL Stream Failed to Authenticate as Client", ex);
}
私のテストプロジェクトのコードは次のとおりです。
public static void SendPingToApple()
{
try
{
var devicetoken = "mytoken";
var appleCert = File.ReadAllBytes(AssemblyPathName + @"\Resources\DistPrivKey1.p12");
var push = new PushBroker();
push.RegisterAppleService(new ApplePushChannelSettings(IsProduction, appleCert, "password"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken(devicetoken.ToUpper())
.WithAlert("Test Notification"));
push.StopAllServices();
}
catch (Exception ex)
{
throw;
}
}