• 小程序报错:对应的服务器 TLS 为 TLS 1.0 ,小程序要求的 TLS 版本必须大于等于 1.2


    我这里出现此错误的原因是,搭载域名网站的服务器是windows2008 r2,配置的域名证书是TLS1.0版本,需要在服务器注册表中加入TLS的其他版本。

    处理办法如下

    小程序报错 TLS 版本必须大于等于 1.2  --文章所有权归周伯通的麦田  ,以下是直接复制内容:


    服务器是windows 2008 server 
    环境是IIS7
    SSL是申请用的阿里免费。微信小程序发现wx.request,调试报错: 小程序要求的 TLS 版本必须大于等于 1.2

    直接说解决办法吧:在PowerShell中运行一下代码(复制粘贴即可),PowerShell窗口打开方式可以用下面任意一种
    1:开始->运行->输入 PowerShell

    2:开始->所有程序->附件 找到

    复制代码
    # Enables TLS 1.2 on windows Server 2008 R2 and Windows 7
    
    # These keys do not exist so they need to be created prior to setting values.
    md "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2"
    md "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server"
    md "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client"
    
    # Enable TLS 1.2 for client and server SCHANNEL communications
    new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server" -name "Enabled" -value 1 -PropertyType "DWord"
    new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord"
    new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client" -name "Enabled" -value 1 -PropertyType "DWord"
    new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client" -name "DisabledByDefault" -value 0 -PropertyType "DWord"
    
    # Disable SSL 2.0 (PCI Compliance)
    md "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsSSL 2.0Server"
    new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsSSL 2.0Server" -name Enabled -value 0 -PropertyType "DWord"
    # Enables TLS 1.2 on Windows Server 2008 R2 and Windows 7 # These keys do not exist so they need to be created prior to setting values. md "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2" md "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server" md "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client" # Enable TLS 1.2 for client and server SCHANNEL communications new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord" new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client" -name "DisabledByDefault" -value 0 -PropertyType "DWord" # Disable SSL 2.0 (PCI Compliance) md "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsSSL 2.0Server" new-itemproperty -path "HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsSSL 2.0Server" -name Enabled -value 0 -PropertyType "DWord"
    复制代码

    输入以上命令后直接回车
    3:重启服务器(我滴重启iis好像没彻底生效)后OK,再请请求wx.request正常

  • 相关阅读:
    mvp在flutter中的应用
    Flutter 网络请求库http
    Flutter Dart中的异步
    阿里云 RDS 数据库又发 CPU 近 100% 的“芯脏病”团队
    上周热点回顾(10.14-10.20) 团队
    云上的芯脏病:奇怪的阿里云 RDS 数据库突发 CPU 近 100% 问题团队
    【故障公告】docker swarm 集群问题引发的故障团队
    上周热点回顾(10.7-10.13)团队
    上周热点回顾(9.30-10.6) 团队
    上周热点回顾(9.23-9.29) 团队
  • 原文地址:https://www.cnblogs.com/senyier/p/11065927.html
Copyright © 2020-2023  润新知