请求被中止: 未能创建 SSL/TLS 安全通道


   public static string PostData(string postUrl, string paramData, Encoding dataEncode)
        {
            string ret = string.Empty;
            try
            {
                Console.WriteLine(postUrl + paramData);
                string result = string.Empty;
                byte[] byteArray = dataEncode.GetBytes(paramData);
                HttpWebRequest webReq = null;
                if (postUrl.StartsWith("https", StringComparison.OrdinalIgnoreCase))
                {
                    Console.WriteLine("https");
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | (SecurityProtocolType)0x300 | (SecurityProtocolType)0xC00;
                    ServicePointManager.ServerCertificateValidationCallback += CheckValidationResult;
                    //ServicePointManager.CheckCertificateRevocationList = false;
                    //ServicePointManager.DefaultConnectionLimit = 512;
                    //ServicePointManager.Expect100Continue = false;
                    webReq = WebRequest.Create(postUrl) as HttpWebRequest;
                    //webReq.ProtocolVersion = HttpVersion.Version10;
                }
                else
                {
                    webReq = (HttpWebRequest)WebRequest.Create(new Uri(postUrl));
                }
                webReq.Method = "post";
                webReq.ContentType = "application/json";
                webReq.ContentLength = byteArray.Length;
                Stream newStream = webReq.GetRequestStream();
                newStream.Write(byteArray, 0, byteArray.Length);//写入参数
                newStream.Close();

                HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
                using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
                {
                    result = reader.ReadToEnd();
                }
                Console.WriteLine(result);
                return result;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return ret;
        }



        public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
        {
            return true;
        }

访问https接口

一台服务器有返回结果 这台服务器.netframework 4.7

另一台服务器返回结果为请求被中止: 未能创建 SSL/TLS 安全通道 这台服务器.netframework 4.0

有知道吗

应该是tls版本问题,试试下的,不行4.0 framework版本的服务器升级下framework,升级到4.5以上