This commit is contained in:
2025-08-30 13:53:59 +08:00
parent cb4c3b2935
commit ed47497d8c
17 changed files with 116 additions and 18 deletions

View File

@@ -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");