Files

65 lines
2.2 KiB
C#
Raw Permalink Normal View History

2025-11-20 15:56:30 +08:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualBasic;
using Newtonsoft.Json;
using RestSharp;
namespace ConsoleApp2
{
internal class Program
{
public static System.Timers.Timer timer;
static void Main(string[] args)
{
//ServiceCollection services = new ServiceCollection();
//string ss0 = File.ReadAllText("1.txt");
//string ss1 = File.ReadAllText("2.txt");
//string n = ss0 + ss1;
//Console.WriteLine(n);
timer = new System.Timers.Timer();
timer.Interval = 60000;
//timer.Interval = 3;
timer.Elapsed += Timer_Elapsed;
timer.Start();
Console.ReadLine();
}
async private static void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
try
{
Console.WriteLine("发送了请求");
await Send_Http_Request_Params(BaseUrl, "/Index.aspx", Method.Get);
await Send_Http_Request_Params(BaseUrl1, "/api/Values/HeartCallWake", Method.Post);
//电话机
await Send_Http_Request_Params(BaseUrl2, "/Home/Halo", Method.Post);
}
catch (Exception)
{
Console.WriteLine("出错了");
}
}
//千里马模拟器
static public string BaseUrl = "http://localhost:19056";
//这台电脑上安装不了.net frameworkd所有不能使用
//现在 安装在47.119电脑上
//static public string BaseUrl1 = "http://pms.boonlive-rcu.com:19055";
//日志服务器
static public string BaseUrl1 = "http://localhost:19055";
static public string BaseUrl2 = "http://blv-rd.tech:19041";
public static async Task<string> Send_Http_Request_Params(string BaseUrlstr, string Url, Method M)
{
var client1 = new RestClient(BaseUrlstr);
var request1 = new RestRequest(Url, M);
var response = await client1.ExecuteAsync(request1);
var content = response.Content;
return content;
}
}
}