45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
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;
|
||
using System.Net;
|
||
|
||
namespace MyCode.Project.ScheduleTask
|
||
{
|
||
class Program
|
||
{
|
||
|
||
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");
|
||
|
||
Console.ReadKey();
|
||
|
||
}
|
||
}
|
||
}
|