TCP CLOSE_WAIT苹果apns

时间:2018-04-18 04:34:00

标签: c# apple-push-notifications asp.net-core-1.1

我们目前使用的是asp.NET Core 1.1.4 ApnsStream.AuthenticateAsClientAsync()永远不会返回。我们尝试使用netstat,连接显示为CLOSE_WAIT。我们还通过推送桌面应用程序发送手动推送通知来验证证书是否有效。

我们将SSL协议更改为tls and tls1以查看它是否会出错,但没有运气。

`

private async Task<bool> OpenSslStreamAsync(string host, X509CertificateCollection certificates)
        {
            Logger.Info("Creating SSL connection.");
            ApnsStream = new SslStream(ApnsClient.GetStream(), false, ValidateServerCertificate, SelectLocalCertificate);

            try
            {
                await ApnsStream.AuthenticateAsClientAsync(host, certificates, System.Security.Authentication.SslProtocols.Tls12, false).ConfigureAwait(false);
            }
            catch (System.Security.Authentication.AuthenticationException ex)
            {
                Logger.Error(ex.Message);
                return false;
            }

            if (!ApnsStream.IsMutuallyAuthenticated)
            {
                Logger.Error("SSL Stream Failed to Authenticate");
                return false;
            }

            if (!ApnsStream.CanWrite)
            {
                Logger.Error("SSL Stream is not Writable");
                return false;
            }
            return true;
        }

`

编辑:

我这次尝试使用Visual Studio而不是Visual Studio Code,并且确实收到了异常:

  

发生了一个或多个错误无法从传输中读取数据   连接:通过对等方重置连接

Visual Studio的框架目标为1.0.4。一旦我将它改回1.1,就像视觉工作室代码一样,它也会挂起。

核心1.1中AuthenticateAsClientAsync api是否已损坏?

0 个答案:

没有答案