初始化
This commit is contained in:
38
心跳维持/Program.cs
Normal file
38
心跳维持/Program.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Timers;
|
||||
using RestSharp;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace 心跳维持
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
public static System.Timers.Timer timer;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
timer = new System.Timers.Timer();
|
||||
timer.Interval = 20000;
|
||||
timer.Elapsed += Timer_Elapsed;
|
||||
timer.Start();
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
private static void Timer_Elapsed(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine("心跳检测");
|
||||
var options = new RestClientOptions("http://localhost:19088/");
|
||||
var client = new RestClient(options);
|
||||
var request = new RestRequest("api/values/HeartBeat");
|
||||
var response = client.Post(request);
|
||||
string? str1 = response.Content;
|
||||
Console.WriteLine(str1);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
心跳维持/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
18
心跳维持/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>bin\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishReadyToRun>false</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
10
心跳维持/Properties/PublishProfiles/FolderProfile.pubxml.user
Normal file
10
心跳维持/Properties/PublishProfiles/FolderProfile.pubxml.user
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2025-07-25T07:34:31.4879290Z||;True|2025-07-25T15:19:59.2970683+08:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
14
心跳维持/心跳维持.csproj
Normal file
14
心跳维持/心跳维持.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
心跳维持/心跳维持.csproj.user
Normal file
6
心跳维持/心跳维持.csproj.user
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_LastSelectedProfileId>E:\tian\BLS\BLWLogServer\心跳维持\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user