static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() .Enrich.FromLogContext() .WriteTo.Async(c => { c.File(path: $"Logs/logs-.log", outputTemplate: SerilogOutputTemplate, fileSizeLimitBytes: 1024000, rollOnFileSizeLimit: true, rollingInterval: RollingInterval.Day, retainedFileCountLimit: 31); }) .CreateLogger(); Log.Logger.Information("正在启动。。。"); DomainRecordOptions domainRecordOptions = new DomainRecordOptions(); DomainRecord domainRecord = new DomainRecord(domainRecordOptions); Log.Logger.Information("启动成功"); while (true) { try { Log.Logger.Information("开始检测"); domainRecord.CheckAndModify().Wait(); } catch (Exception ex) { Log.Logger.Error(ex, "CheckAndModify Error"); } Thread.Sleep(30000); } }
public DomainRecord(DomainRecordOptions options) { Options = options; var profile = DefaultProfile.GetProfile(Options.RegionId, Options.AccessKeyId, Options.AccessKeySecret); client = new DefaultAcsClient(profile); request = new DescribeDomainRecordsRequest(); //request.Url = "http://domain.aliyuncs.com/"; request.DomainName = Options.DomainName; request.TypeKeyWord = Options.DomainType; //request.ActionName = "DescribeDomainRecords"; var response = client.GetAcsResponse(request); describeDomainRecords_Records = response.DomainRecords; }