From c54d598cc71ca26f262d498e034b64627d7b6616 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期四, 07 七月 2022 15:25:19 +0800 Subject: [PATCH] 提交 --- zhengcaioa/Crawler/Program.cs | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/zhengcaioa/Crawler/Program.cs b/zhengcaioa/Crawler/Program.cs index aa22779..e71f603 100644 --- a/zhengcaioa/Crawler/Program.cs +++ b/zhengcaioa/Crawler/Program.cs @@ -5,6 +5,7 @@ using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using System; +using System.Net; using System.Net.Http; using System.Threading; using zhengcaioa.Models; @@ -13,6 +14,9 @@ { class Program { + + public static string connection = @"server=.;database=WebCrawler;uid=sa;pwd=123456;"; + //public static string connection = @"server=172.26.97.147;database=WebCrawler;uid=sa;pwd=Za20222812;"; static void Main(string[] args) { @@ -142,12 +146,13 @@ { while (true) { - string connection = @"server=.;database=WebCrawler;uid=sa;pwd=123456;"; + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>(); var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection).Options); //鑾峰彇鍥涘窛鐨勬斂閲囨暟鎹� sichuanoperation.operations(cccontext); - Thread.CurrentThread.Join(1000*60*60*2);//闃绘璁惧畾鏃堕棿 + //Console.WriteLine("杩欎釜鏆傚仠"); + Thread.CurrentThread.Join(1000 * 60 * 60 * 2);//闃绘璁惧畾鏃堕棿 } } @@ -155,8 +160,12 @@ { while (true) { - Console.WriteLine(DateTime.Now.ToString() + "Method2_" + Thread.CurrentThread.ManagedThreadId.ToString()); - Thread.CurrentThread.Join(1000);//闃绘璁惧畾鏃堕棿 + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>(); + var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection).Options); + //鑾峰彇鍥涘窛鐨勬斂閲囨暟鎹� + OldSichuanoperation.operations(cccontext); + Thread.CurrentThread.Join(1000 * 60 * 60 * 2);//闃绘璁惧畾鏃堕棿 } } -- Gitblit v1.9.1