| | |
| | | Thread thread1 = new Thread(new ThreadStart(obj.Method2)); |
| | | thread1.Start(); |
| | | |
| | | |
| | | Thread thread2 = new Thread(new ThreadStart(obj.Method3)); |
| | | thread2.Start(); |
| | | |
| | | Console.WriteLine("Hello World!"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | void Method3() |
| | | { |
| | | while (true) |
| | | { |
| | | ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; |
| | | var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>(); |
| | | var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection).Options); |
| | | |
| | | //var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>(); |
| | | //var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options); |
| | | |
| | | //获取中国政采网的四川政采数据 |
| | | CcgpSichuanoperation.operations(cccontext); |
| | | Thread.CurrentThread.Join(1000 * 60 * 60 * 2);//阻止设定时间 |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |