定时调度https地址
class Program { static void Main(string[] args) { while (true) { try { // ./nssm install LifeManager.Timing // sc delete LifeManager.Timing ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((a,b,c,d)=> { return true; }); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; WebClient webClient = new WebClient(); var resBytes = webClient.DownloadData("https://life.dongbencq.com/api/WX/GetUser?code=123"); Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss")}]" + Encoding.UTF8.GetString(resBytes)); } catch (Exception ex) { Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss")}]" + ex.Message); } Thread.Sleep(1000 * 60 * 2); } } }
定时调度,地址是https地址。