Visual Studio 2017 15.9 升级后,WebDeploy 失败并出现 SSL/TLS 错误

WebDeploy fails with SSL/TLS error after Visual Studio 2017 15.9 upgrade

我在 Visual Studio 2017 年使用内置 Web 发布和 Web 部署来部署到内部网站。 15.9.3 升级后,web 部署发布现在失败并显示错误:

---------------------------
Microsoft Visual Studio
---------------------------
Could not complete the request to remote agent URL 'https://[redacted]:8172/msdeploy.axd?site=[redacted]'. 
The request was aborted: Could not create SSL/TLS secure channel.
---------------------------
OK   
---------------------------

这确实适用于 Visual Studio 2015 年的完全相同的 .sln 文件,因此服务器设置没有本质上的错误。目标服务器是 Windows Server 2008 R2。一直没有其他更新等

那么,是什么原因呢?如何重新启用网络部署

基于@PanagiotisKanavos,问题是为 Windows Server 2008 R2 启用 TLS 1.1 和 TLS 1.2。内置 Web 部署似乎是 Visual Studio 2017 15.9.x 升级的一部分,不再支持现已过时的 SSL 2.0。

最后,我按照 KB3140245, which included both an update and setting registry values 的说明进行操作(也在下面,从该答案中复制)。

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp

On x64-based computers, DefaultSecureProtocols must also be added to the Wow6432Node path:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp

我还应用了这些注册表项:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001

我可能是用力过猛了,所以上面的条目可能不是必需的。