问题描述
我有一个 ASP.NET Core 2.0 REST 服务器运行良好,但我需要限制对 TLS1.2 的访问 - 我该怎么做?似乎找不到任何关于它的文档.服务器正在 Kestrel 上运行.谢谢!
I have an ASP.NET Core 2.0 REST server running fine, but I need to restrict access to TLS1.2 - how do I do this? Can't seem to find any documentation on it.Server is running on Kestrel.Thanks!
推荐答案
有一个 https://code>
https://code.en-us/dotnet/api/microsoft.aspnetcore.server.kestrel.https.httpsconnectionadapteroptions?view=aspnetcore-2.0" rel="noreferrer">
HttpsConnectionAdapterOptions
实例来配置它.以下是在您的情况下可能是什么样子的示例:
There's a UseHttps
overload that allows you to provide a HttpsConnectionAdapterOptions
instance to configure this. Here's an example of what this might look like in your case:
listenOptions.UseHttps(new HttpsConnectionAdapterOptions
{
...
SslProtocols = SslProtocols.Tls12
});
作为参考,SslProtocols
默认 为 SslProtocols.Tls12 |SslProtocols.Tls11
.
这篇关于有什么方法可以将 ASP.NET Core 2.0 HTTPS 限制为 TLS 1.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!