From b887b6d41a04f4a2d0ca89891f19d8baa2b9c91e Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Sat, 18 Feb 2023 11:35:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=9C=8D=E5=8A=A1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Learun.Framework.Ultimate V7/VisitService/Service1.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) {