11
This commit is contained in:
@@ -8,6 +8,7 @@ using MyCode.Project.Infrastructure.UnityExtensions;
|
||||
using MyCode.Project.Infrastructure.Common;
|
||||
using MyCode.Project.Services;
|
||||
using System.Threading;
|
||||
using System.Net;
|
||||
|
||||
namespace MyCode.Project.ScheduleTask
|
||||
{
|
||||
@@ -16,7 +17,23 @@ namespace MyCode.Project.ScheduleTask
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
// 在应用程序启动时设置(如Main方法或Application_Start)
|
||||
System.Net.ServicePointManager.SecurityProtocol =
|
||||
SecurityProtocolType.Tls12;
|
||||
// 检查.NET版本并做相应处理
|
||||
if (Environment.Version.Major >= 4) // .NET 4.0+
|
||||
{
|
||||
try
|
||||
{
|
||||
// 尝试设置TLS 1.2
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
// 如果失败,可能需要安装系统更新
|
||||
Console.WriteLine("您的系统需要更新以支持TLS 1.2");
|
||||
}
|
||||
}
|
||||
|
||||
JobsHelp.start(AppDomain.CurrentDomain.BaseDirectory + "/JobConfig.xml");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user