diff --git a/Learun.Framework.Ultimate V7/VisitService/App.config b/Learun.Framework.Ultimate V7/VisitService/App.config index 54ca83f10..139ba7c57 100644 --- a/Learun.Framework.Ultimate V7/VisitService/App.config +++ b/Learun.Framework.Ultimate V7/VisitService/App.config @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/VisitService/Service1.cs b/Learun.Framework.Ultimate V7/VisitService/Service1.cs index 6e2dd3ce2..2d1b01d03 100644 --- a/Learun.Framework.Ultimate V7/VisitService/Service1.cs +++ b/Learun.Framework.Ultimate V7/VisitService/Service1.cs @@ -55,16 +55,29 @@ namespace VisitService System.GC.Collect(); var url = System.Configuration.ConfigurationManager.AppSettings["cyapi"].ToString(); - HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url); - myRequest.KeepAlive = false; - myRequest.Method = "HEAD"; //设置提交方式可以为"get","head"等 - myRequest.Timeout = 30000; //设置网页响应时间长度 - myRequest.AllowAutoRedirect = false; //是否允许自动重定向 - HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse(); - // return (myResponse.StatusCode == HttpStatusCode.OK);//返回响应的状态 + var arr = url.Split(';'); + foreach (var item in arr) + { + try + { + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url); + myRequest.KeepAlive = false; + myRequest.Method = "HEAD"; //设置提交方式可以为"get","head"等 + myRequest.Timeout = 30000; //设置网页响应时间长度 + myRequest.AllowAutoRedirect = false; //是否允许自动重定向 + HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse(); + // return (myResponse.StatusCode == HttpStatusCode.OK);//返回响应的状态 + + System.IO.File.AppendAllText(logPath_timer, + "\r\n" + DateTime.Now + "\r\n访问结果:" + myResponse.StatusCode); + } + catch (Exception ex) + { + System.IO.File.AppendAllText(logPath_timer, + "\r\n" + DateTime.Now + "\r\n访问结果异常,异常信息:" + ex.Message + ",访问地址:" + item); + } + } - System.IO.File.AppendAllText(logPath_timer, - "\r\n" + DateTime.Now + "\r\n访问结果:" + myResponse.StatusCode); } catch (Exception ex) {