Enable system default TLS versions when targeting .NET Framework 4.6.1

pull/498/head
NextTurn 2019-03-06 00:00:00 +08:00 committed by Next Turn
parent 00c9f37041
commit 505c2385c9
1 changed files with 5 additions and 2 deletions

View File

@ -36,9 +36,12 @@ namespace winsw
public string ShortId => $"(download from {From})";
#if !VNEXT
static Download()
{
#if NET461
// If your app runs on .NET Framework 4.7 or later versions, but targets an earlier version
AppContext.SetSwitch("Switch.System.Net.DontEnableSystemDefaultTlsVersions", false);
#elif !VNEXT
const SecurityProtocolType Tls12 = (SecurityProtocolType)0x00000C00;
const SecurityProtocolType Tls11 = (SecurityProtocolType)0x00000300;
@ -55,8 +58,8 @@ namespace winsw
Logger.Info("TLS 1.1/1.2 disabled");
}
}
}
#endif
}
// internal
public Download(