进入阿里云控制台后,选择CA证书服务
html
选择购买证书
web
可是阿里云的免费SSL证书藏得比较深,得这样操做才能显示出免费证书
点击Symantec
->点击加强型OV SSL
->点击免费型DV SSL
->支付便可
步骤1:
小程序
步骤2:
windows
步骤3:
微信小程序
步骤4:
服务器
步骤5:
微信
补全证书信息,因为是免费证书,所以只能填写一个域名,并且没法使用通配符
步骤1:填写域名
app
步骤2:补全信息
ide
问题描述
微信小程序使用wx.request
时,调试报错:小程序要求的TLS版本必须大于等于1.2.
工具
前提
Windows 系统 TLS 支持状况
备注:若是操做系统不支持相应TLS则没法使用如下解决方案
也能够经过该网址判断是否已支持TLS
https://www.ssllabs.com/ssltest/index.html
经过如下内容可判断是否已支持相应TLS
PowerShell
中执行完成后,直接回车便可。# 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:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2" md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" # Enable TLS 1.2 for client and server SCHANNEL communications new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "DisabledByDefault" -value 0 -PropertyType "DWord" # Disable SSL 2.0 (PCI Compliance) md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" -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:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2" md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" # Enable TLS 1.2 for client and server SCHANNEL communications new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "DisabledByDefault" -value 0 -PropertyType "DWord" # Disable SSL 2.0 (PCI Compliance) md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" -name Enabled -value 0 -PropertyType "DWord"
最后:重启服务器(必须步骤)后就能够了,再进行wx.request
请求
Http
验证时没有任何问题,使用SSL
后;经过微信小程序Post文件流,就会致使异常:未显示页面 由于请求实体过大
的413 错误;可是在 Chrome 内核的微信小程序编辑工具中,则不存在该问题。UploadReadAheadSize
长度过小的问题。cd C:\Windows\System32\Inetsrv
目录执行命令行appcmd.exe list config -section:system.webServer/serverRuntime // 查看当前设置的 UploadReadAheadSize 大小(byte) appcmd.exe set config -section:system.webServer/serverruntime /uploadreadaheadsize:204800 /commit:apphost // 根据须要调整大小;