- A+
原因
从VS2013版后VS就要求要登陆才能使用了,而每一次的授权只有三个月,三个月一到又会要求登陆更新许可证.
之所以出现这个问题,是因为TLS1.2没有启用的原因(应该是微软网站有更新,需要TLS1.2才能访问了).
TLS1.2没有启用会影响到很多地方,比如netcore 6生成的网站都会有ssl网址 https://localhost.... 没有启用则访问不了.
处理方法
启用方法如下:
1.打开链接地址
https://docs.microsoft.com/en-us/azure/active-directory/hybrid/reference-connect-tls-enforcement
2. 找到 [ PowerShell script to enable TLS 1.2 ] ,点击下面那个Copy,
3.在开始菜单中找到Windows PowerShell ISE,贴入刚复制的代码并按F5运行. 此步操作将向注册表加入几个启用TLS1.2的键值.
4.重启电脑,VS已经可以快乐的登陆啦.
附上相关代码
`If (-Not (Test-Path 'HKLM:SOFTWAREWOW6432NodeMicrosoft.NETFrameworkv4.0.30319'))
{
New-Item 'HKLM:SOFTWAREWOW6432NodeMicrosoft.NETFrameworkv4.0.30319' -Force | Out-Null
}
New-ItemProperty -Path 'HKLM:SOFTWAREWOW6432NodeMicrosoft.NETFrameworkv4.0.30319' -Name 'SystemDefaultTlsVersions' -Value '1' -PropertyType 'DWord' -Force | Out-Null
New-ItemProperty -Path 'HKLM:SOFTWAREWOW6432NodeMicrosoft.NETFrameworkv4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -PropertyType 'DWord' -Force | Out-Null
If (-Not (Test-Path 'HKLM:SOFTWAREMicrosoft.NETFrameworkv4.0.30319'))
{
New-Item 'HKLM:SOFTWAREMicrosoft.NETFrameworkv4.0.30319' -Force | Out-Null
}
New-ItemProperty -Path 'HKLM:SOFTWAREMicrosoft.NETFrameworkv4.0.30319' -Name 'SystemDefaultTlsVersions' -Value '1' -PropertyType 'DWord' -Force | Out-Null
New-ItemProperty -Path 'HKLM:SOFTWAREMicrosoft.NETFrameworkv4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -PropertyType 'DWord' -Force | Out-Null
If (-Not (Test-Path 'HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server'))
{
New-Item 'HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server' -Force | Out-Null
}
New-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server' -Name 'Enabled' -Value '1' -PropertyType 'DWord' -Force | Out-Null
New-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Server' -Name 'DisabledByDefault' -Value '0' -PropertyType 'DWord' -Force | Out-Null
If (-Not (Test-Path 'HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client'))
{
New-Item 'HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client' -Force | Out-Null
}
New-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client' -Name 'Enabled' -Value '1' -PropertyType 'DWord' -Force | Out-Null
New-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2Client' -Name 'DisabledByDefault' -Value '0' -PropertyType 'DWord' -Force | Out-Null
Write-Host 'TLS 1.2 has been enabled. You must restart the Windows Server for the changes to take affect.' -ForegroundColor Cyan`