【问题标题】:X509Chain error on .NET Core running on Mac在 Mac 上运行的 .NET Core 上出现 X509Chain 错误
【发布时间】:2019-03-08 02:37:33
【问题描述】:

我使用 .net core 2.1 和 C# 开发了一个应用程序,在这个应用程序中,我在 Windows 版本中通过 HTTPS (SSL) 调用 API,自包含应用程序工作正常,但在 Mac 上我收到以下错误:

System.Net.Http.HttpRequestException:无法建立 SSL 连接 成立,见内部异常。 ---> System.PlatformNotSupportedException:X509Chain 在 Internal.Cryptography.Pal.SecTrustChainPal.PreparePoliciesArray(布尔值 checkRevocation) 在 Internal.Cryptography.Pal.SecTrustChainPal.OpenTrustHandle(ICertificatePal 叶证书,X509Certificate2Collection extraStore,X509RevocationMode 撤销模式)在 Internal.Cryptography.Pal.ChainPal.BuildChain(布尔值 useMachineContext、ICertificatePal 证书、X509Certificate2Collection extraStore, OidCollection applicationPolicy, OidCollection certificatePolicy, X509RevocationMode revocationMode, X509RevocationFlag revocationFlag, DateTime 验证时间, TimeSpan 超时)在 System.Security.Cryptography.X509Certificates.X509Chain.Build(X509Certificate2 证书,布尔 throwOnException)在 System.Security.Cryptography.X509Certificates.X509Chain.Build(X509Certificate2 证书)在 System.Net.CertificateValidationPal.VerifyCertificateProperties(SafeDeleteContext securityContext, X509Chain 链, X509Certificate2 remoteCertificate, Boolean checkCertName, Boolean isServer, String hostName) at System.Net.Security.SecureChannel.VerifyRemoteCertificate(RemoteCertValidationCallback remoteCertValidationCallback、ProtocolToken 和 alertToken)在 System.Net.Security.SslState.CompleteHandshake(ProtocolToken& 警报令牌)在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(协议令牌 消息,AsyncProtocolRequest asyncRequest)在 System.Net.Security.SslState.StartSendBlob(字节 [] 传入,Int32 计数,AsyncProtocolRequest asyncRequest)在 System.Net.Security.SslState.ProcessReceivedBlob(字节 [] 缓冲区,Int32 计数,AsyncProtocolRequest asyncRequest)在 System.Net.Security.SslState.StartReadFrame(字节 [] 缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest)在 System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest 异步请求) --- 从先前引发异常的位置结束堆栈跟踪 --- 在 System.Net.Security.SslState.ThrowIfExceptional()
在 System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult 懒惰的结果)在 System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult 结果)在 System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult) 在 System.Net.Security.SslStream.c.b__47_1(IAsyncResult iar)在 System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean 需要同步) --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(流 流,SslClientAuthenticationOptions sslOptions,CancellationToken 取消令牌)

【问题讨论】:

标签: c# macos ssl .net-core


【解决方案1】:

我在 stackOverflow 的以下帖子中找到了解决此问题的方法

Ignore bad certificate - .NET CORE

【讨论】:

    猜你喜欢
    • 2020-01-13
    • 1970-01-01
    • 2014-12-27
    • 2020-07-15
    • 2016-02-09
    • 1970-01-01
    • 2019-06-02
    • 2018-09-16
    • 2021-11-08
    相关资源
    最近更新 更多