2025-04-21 14:10:27 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Microsoft.Practices.Unity;
|
|
|
|
|
|
using MyCode.Project.Infrastructure.UnityExtensions;
|
|
|
|
|
|
using MyCode.Project.Infrastructure.Common;
|
|
|
|
|
|
using MyCode.Project.Services;
|
|
|
|
|
|
using System.Threading;
|
2025-08-30 13:53:59 +08:00
|
|
|
|
using System.Net;
|
2025-04-21 14:10:27 +08:00
|
|
|
|
|
|
|
|
|
|
namespace MyCode.Project.ScheduleTask
|
|
|
|
|
|
{
|
|
|
|
|
|
class Program
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
|
{
|
2025-08-30 13:53:59 +08:00
|
|
|
|
// 在应用程序启动时设置(如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");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-04-21 14:10:27 +08:00
|
|
|
|
|
|
|
|
|
|
JobsHelp.start(AppDomain.CurrentDomain.BaseDirectory + "/JobConfig.xml");
|
|
|
|
|
|
|
|
|
|
|
|
Console.ReadKey();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|