public static List <DayCareModel> GetDetailData(List <ScrapeSource> list) { var resultList = new List <DayCareModel>(); DayCareScrape me = new DayCareScrape("http://www.dleg.state.mi.us"); foreach (var r in list) { try { Console.WriteLine(BuildLogMessage(r)); var result = me.ExtractDayCareDetailList("http://www.dleg.state.mi.us/brs_cdc/" + r.DetailUrl); result.FacilityInformation.County = r.County; if (string.IsNullOrEmpty(result.FacilityInformation.Name)) { LogHelper.log.Info(BuildLogMessage(r) + " no data scraped"); LogHelper.log.Info(BuildLogMessage(r) + " scrape again"); try { result = me.ExtractDayCareDetailList("http://www.dleg.state.mi.us/brs_cdc/" + r.DetailUrl); result.FacilityInformation.County = r.County; resultList.Add(result); } catch (Exception subex) { LogHelper.log.Info(BuildLogMessage(r) + "exception:" + subex.ToString()); } } resultList.Add(result); } catch (Exception ex) { LogHelper.log.Info(BuildLogMessage(r) + "exception:" + ex.ToString()); if (ex.Message.IndexOf("The operation has timed out") >= 0 || ex.Message.IndexOf("无法连接到远程服务器") >= 0 || ex.Message.IndexOf("基础连接已经关闭") >= 0) { LogHelper.log.Info(BuildLogMessage(r) + " scrape again:"); try { var result = me.ExtractDayCareDetailList("http://www.dleg.state.mi.us/brs_cdc/" + r.DetailUrl); result.FacilityInformation.County = r.County; resultList.Add(result); } catch (Exception subex) { LogHelper.log.Info(BuildLogMessage(r) + "exception:" + subex.ToString()); } } } Console.WriteLine(BuildLogMessage(r) + "- End..."); } return(resultList); }