asp.net - 禁用 TLS 1.0 会破坏 ASP.NET 应用程序
问题描述
在 Windows Server 2012R2 上运行
我正在尝试在 IIS 上禁用 TLS 1.0,因为客户端有一个站点扫描程序,它突出显示这是一个安全问题。
我设置了一个干净的测试服务器,并且应用程序运行良好,直到我禁用 TLS 1.0。
我更新了所有适当的设置:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727]
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client]
"Enabled"=dword:ffffffff
"DisabledByDefault"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server]
"Enabled"=dword:ffffffff
"DisabledByDefault"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"Enabled"=dword:ffffffff
"DisabledByDefault"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"Enabled"=dword:ffffffff
"DisabledByDefault"=dword:00000000
在事件查看器中,我得到:
已生成致命警报并将其发送到远程端点。这可能会导致连接终止。TLS 协议定义的致命错误代码为 70。Windows SChannel 错误状态为 105。
如果我仅恢复 TLS 1.0 的注册表设置(启用,而不是 DisabledByDefault),一切都会再次正常。
在 system.web 中使用:
<httpRuntime targetFramework="4.7.2" />
我错过了什么?
解决方案
应用程序本身必须更新以支持 TLS 1.2 握手,因此如果您只能访问配置,则不一定可以更改。如果底层代码不支持它,它将无法工作。
如果代码以 .NET 4.6 为目标,我相信 TLS 1.2 将在本地运行。在 4.5 中,必须放置一行代码,以便在任何网络发生之前执行它。编码:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
推荐阅读
- c# - 将值添加到 DataGridview 中的特定单元格
- ruby-on-rails - 如何将变量从控制器传递到rails中的部分视图文件?
- python - 如何在 Pandas 数据框中将 ISO-8601 对象转换为 DateTime 格式?
- laravel - 未找到 Laravel Aws\Kinesis\KinesisClient
- c# - FileSystemWatcher() 的文件过滤器
- c# - MVVM WPF:根据所选项目从 DataGridComboBoxColumn 中删除元素
- forms - 当我单击输入登录表单时,应在 ionic 4 中提交
- python-3.x - 为什么在 Ubuntu 19.10 中安装 tensorflow-gpu 后 tensorflow 不工作?
- javascript - Material-table:是否可以默认打开detailsPanel?
- php - 试图获取非对象的属性“cover_image”(查看:C:\Users\BWB\Documents\Laravel\asperablogs\resources\views\blogs\blogs.blade.php)