barhen-pfw
2 years ago
13 changed files with 173 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio Version 17 |
|||
VisualStudioVersion = 17.5.33530.505 |
|||
MinimumVisualStudioVersion = 10.0.40219.1 |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientManager", "ClientManager\ClientManager.csproj", "{AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}" |
|||
EndProject |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerManager", "ServerManager\ServerManager.csproj", "{7A6AAC33-5ED1-4CAD-AA67-E107245354B3}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|Any CPU = Debug|Any CPU |
|||
Release|Any CPU = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{7A6AAC33-5ED1-4CAD-AA67-E107245354B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{7A6AAC33-5ED1-4CAD-AA67-E107245354B3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{7A6AAC33-5ED1-4CAD-AA67-E107245354B3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{7A6AAC33-5ED1-4CAD-AA67-E107245354B3}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
GlobalSection(ExtensibilityGlobals) = postSolution |
|||
SolutionGuid = {B70A1395-0B43-467D-83F6-552CD8A92A8B} |
|||
EndGlobalSection |
|||
EndGlobal |
@ -0,0 +1,13 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Worker"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<Nullable>enable</Nullable> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<UserSecretsId>dotnet-ClientManager-173f3572-8fd4-498f-addd-d620cda23800</UserSecretsId> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> |
|||
</ItemGroup> |
|||
</Project> |
@ -0,0 +1,10 @@ |
|||
using ClientManager; |
|||
|
|||
IHost host = Host.CreateDefaultBuilder(args) |
|||
.ConfigureServices(services => |
|||
{ |
|||
services.AddHostedService<Worker>(); |
|||
}) |
|||
.Build(); |
|||
|
|||
host.Run(); |
@ -0,0 +1,11 @@ |
|||
{ |
|||
"profiles": { |
|||
"ClientManager": { |
|||
"commandName": "Project", |
|||
"dotnetRunMessages": true, |
|||
"environmentVariables": { |
|||
"DOTNET_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
namespace ClientManager |
|||
{ |
|||
public class Worker : BackgroundService |
|||
{ |
|||
private readonly ILogger<Worker> _logger; |
|||
|
|||
public Worker(ILogger<Worker> logger) |
|||
{ |
|||
_logger = logger; |
|||
} |
|||
|
|||
protected override async Task ExecuteAsync(CancellationToken stoppingToken) |
|||
{ |
|||
while (!stoppingToken.IsCancellationRequested) |
|||
{ |
|||
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); |
|||
await Task.Delay(1000, stoppingToken); |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
using ServerManager; |
|||
|
|||
IHost host = Host.CreateDefaultBuilder(args) |
|||
.ConfigureServices(services => |
|||
{ |
|||
services.AddHostedService<Worker>(); |
|||
}) |
|||
.Build(); |
|||
|
|||
host.Run(); |
@ -0,0 +1,11 @@ |
|||
{ |
|||
"profiles": { |
|||
"ServerManager": { |
|||
"commandName": "Project", |
|||
"dotnetRunMessages": true, |
|||
"environmentVariables": { |
|||
"DOTNET_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Worker"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<Nullable>enable</Nullable> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<UserSecretsId>dotnet-ServerManager-52a85e73-fd4f-461a-8b7b-99494934c716</UserSecretsId> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> |
|||
</ItemGroup> |
|||
</Project> |
@ -0,0 +1,21 @@ |
|||
namespace ServerManager |
|||
{ |
|||
public class Worker : BackgroundService |
|||
{ |
|||
private readonly ILogger<Worker> _logger; |
|||
|
|||
public Worker(ILogger<Worker> logger) |
|||
{ |
|||
_logger = logger; |
|||
} |
|||
|
|||
protected override async Task ExecuteAsync(CancellationToken stoppingToken) |
|||
{ |
|||
while (!stoppingToken.IsCancellationRequested) |
|||
{ |
|||
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); |
|||
await Task.Delay(1000, stoppingToken); |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue