From 4bd4d7eae55acd7c55f7694cb13c06669abba977 Mon Sep 17 00:00:00 2001
From: zhangli <1109134334@qq.com>
Date: Sat, 18 Feb 2023 10:55:24 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E8=AE=BF=E9=97=AE=E6=9C=8D?=
=?UTF-8?q?=E5=8A=A1=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=94=AF=E6=8C=81=E8=AE=BF?=
=?UTF-8?q?=E9=97=AE=E5=A4=9A=E4=B8=AA=E5=9C=B0=E5=9D=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../VisitService/App.config | 2 +-
.../VisitService/Service1.cs | 31 +++++++++++++------
2 files changed, 23 insertions(+), 10 deletions(-)
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)
{