diff --git a/Learun.Framework.Ultimate V7/VisitService/Service1.cs b/Learun.Framework.Ultimate V7/VisitService/Service1.cs index 57d59a2d3..3998ec890 100644 --- a/Learun.Framework.Ultimate V7/VisitService/Service1.cs +++ b/Learun.Framework.Ultimate V7/VisitService/Service1.cs @@ -53,7 +53,6 @@ namespace VisitService fs.Close(); } - System.GC.Collect(); var url = System.Configuration.ConfigurationManager.AppSettings["cyapi"].ToString(); var arr = url.Split(';'); foreach (var item in arr) @@ -62,16 +61,17 @@ namespace VisitService { System.IO.File.AppendAllText(logPath_timer, "\r\n" + DateTime.Now + "\r\n开始访问:" + item); + HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url); myRequest.KeepAlive = false; myRequest.Method = "HEAD"; //设置提交方式可以为"get","head"等 - myRequest.Timeout = 30000; //设置网页响应时间长度 + //myRequest.Timeout = 60000; //设置网页响应时间长度 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); + myResponse.Dispose(); } catch (Exception ex) {