Merged PR 68: .NET 6 upgrade
- .NET 6 upgrade - .NET 6 upgrade - publish profile updatemaster
parent
939efdb781
commit
c4b129a565
|
@ -1,7 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<Import Project="dependencies.props" />
|
<Import Project="dependencies.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.0.7</Version>
|
<Version>1.1.0</Version>
|
||||||
<Authors>Tudor Stanciu</Authors>
|
<Authors>Tudor Stanciu</Authors>
|
||||||
<Company>STA</Company>
|
<Company>STA</Company>
|
||||||
<PackageTags>NetworkResurrector</PackageTags>
|
<PackageTags>NetworkResurrector</PackageTags>
|
||||||
|
|
|
@ -38,4 +38,10 @@
|
||||||
• Exposing two new methods "/ping" and "/version" in a new controller "/system".
|
• Exposing two new methods "/ping" and "/version" in a new controller "/system".
|
||||||
</Content>
|
</Content>
|
||||||
</Note>
|
</Note>
|
||||||
|
<Note>
|
||||||
|
<Version>1.1.0</Version>
|
||||||
|
<Content>
|
||||||
|
.NET 6 upgrade
|
||||||
|
</Content>
|
||||||
|
</Note>
|
||||||
</ReleaseNotes>
|
</ReleaseNotes>
|
|
@ -1,18 +1,18 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup Label="Package Versions">
|
<PropertyGroup Label="Package Versions">
|
||||||
<MicrosoftExtensionsPackageVersion>5.0.0</MicrosoftExtensionsPackageVersion>
|
<MicrosoftExtensionsPackageVersion>6.0.0</MicrosoftExtensionsPackageVersion>
|
||||||
<MicrosoftExtensionsHostingPackageVersion>5.0.1</MicrosoftExtensionsHostingPackageVersion>
|
<MicrosoftExtensionsHostingPackageVersion>6.0.1</MicrosoftExtensionsHostingPackageVersion>
|
||||||
<SerilogPackageVersion>4.1.0</SerilogPackageVersion>
|
<SerilogPackageVersion>4.1.0</SerilogPackageVersion>
|
||||||
<SerilogExtensionsPackageVersion>3.1.0</SerilogExtensionsPackageVersion>
|
<SerilogExtensionsPackageVersion>3.1.0</SerilogExtensionsPackageVersion>
|
||||||
<SerilogSinksConsolePackageVersion>4.0.0</SerilogSinksConsolePackageVersion>
|
<SerilogSinksConsolePackageVersion>4.0.1</SerilogSinksConsolePackageVersion>
|
||||||
<SerilogSinksMSSqlServerPackageVersion>5.6.1</SerilogSinksMSSqlServerPackageVersion>
|
<SerilogSinksMSSqlServerPackageVersion>5.6.1</SerilogSinksMSSqlServerPackageVersion>
|
||||||
<AutoMapperPackageVersion>10.1.1</AutoMapperPackageVersion>
|
<AutoMapperPackageVersion>10.1.1</AutoMapperPackageVersion>
|
||||||
<AutoMapperExtensionsPackageVersion>8.1.1</AutoMapperExtensionsPackageVersion>
|
<AutoMapperExtensionsPackageVersion>8.1.1</AutoMapperExtensionsPackageVersion>
|
||||||
<MediatRPackageVersion>6.0.0</MediatRPackageVersion>
|
<MediatRPackageVersion>9.0.0</MediatRPackageVersion>
|
||||||
<EntityFrameworkCorePackageVersion>5.0.12</EntityFrameworkCorePackageVersion>
|
<EntityFrameworkCorePackageVersion>6.0.1</EntityFrameworkCorePackageVersion>
|
||||||
<NDBExtensionsSwaggerPackageVersion>1.0.4</NDBExtensionsSwaggerPackageVersion>
|
<NetmashExtensionsSwaggerPackageVersion>1.0.6</NetmashExtensionsSwaggerPackageVersion>
|
||||||
<NDBApplicationPackageVersion>1.0.0</NDBApplicationPackageVersion>
|
<NetmashApplicationPackageVersion>1.0.1</NetmashApplicationPackageVersion>
|
||||||
<NDBSecurityAuthenticationPackageVersion>1.0.7</NDBSecurityAuthenticationPackageVersion>
|
<NetmashSecurityAuthenticationPackageVersion>1.0.8</NetmashSecurityAuthenticationPackageVersion>
|
||||||
<NDBDatabaseMigrationPackageVersion>1.1.3</NDBDatabaseMigrationPackageVersion>
|
<NetmashDatabaseMigrationPackageVersion>1.2.0</NetmashDatabaseMigrationPackageVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="NDB.Application.DataContracts" Version="$(NDBApplicationPackageVersion)" />
|
<PackageReference Include="Netmash.Application.DataContracts" Version="$(NetmashApplicationPackageVersion)" />
|
||||||
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
|
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
using NetworkResurrector.Agent.PublishedLanguage.Dto;
|
||||||
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
using NetworkResurrector.Agent.PublishedLanguage.Events;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Description>Network resurrector agent published language nuget package</Description>
|
<Description>Network resurrector agent published language nuget package</Description>
|
||||||
<PackageProjectUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</PackageProjectUrl>
|
<PackageProjectUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</PackageProjectUrl>
|
||||||
<RepositoryUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</RepositoryUrl>
|
<RepositoryUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</RepositoryUrl>
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NDB.Application.DataContracts" Version="$(NDBApplicationPackageVersion)" />
|
<PackageReference Include="Netmash.Application.DataContracts" Version="$(NetmashApplicationPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Description>Network resurrector agent wrapper nuget package</Description>
|
<Description>Network resurrector agent wrapper nuget package</Description>
|
||||||
<PackageProjectUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</PackageProjectUrl>
|
<PackageProjectUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</PackageProjectUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
using Serilog.Sinks.MSSqlServer;
|
|
||||||
|
|
||||||
namespace NetworkResurrector.Agent.Extensions.Serilog.Sinks.MSSqlServer
|
|
||||||
{
|
|
||||||
public static class ColumnOptionsExtension
|
|
||||||
{
|
|
||||||
public static ColumnOptions AsStandard(this ColumnOptions columnOptions)
|
|
||||||
{
|
|
||||||
columnOptions.Store.Remove(StandardColumn.Properties);
|
|
||||||
columnOptions.Store.Remove(StandardColumn.MessageTemplate);
|
|
||||||
columnOptions.Store.Add(StandardColumn.LogEvent);
|
|
||||||
columnOptions.AdditionalColumns = new System.Collections.ObjectModel.Collection<SqlColumn>
|
|
||||||
{
|
|
||||||
new SqlColumn() { ColumnName = "Agent", DataType = System.Data.SqlDbType.VarChar, DataLength = 100 }
|
|
||||||
};
|
|
||||||
|
|
||||||
return columnOptions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +1,26 @@
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using MediatR.Pipeline;
|
using MediatR.Pipeline;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Netmash.Extensions.Swagger;
|
||||||
using NDB.Extensions.Swagger;
|
using Netmash.Extensions.Swagger.Constants;
|
||||||
using NDB.Extensions.Swagger.Constants;
|
using Netmash.Security.Authentication.Identity;
|
||||||
using NDB.Security.Authentication.Identity;
|
|
||||||
using NetworkResurrector.Agent.Application;
|
using NetworkResurrector.Agent.Application;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace NetworkResurrector.Agent
|
namespace NetworkResurrector.Agent.Extensions
|
||||||
{
|
{
|
||||||
public class Startup
|
public static class StartupExtensions
|
||||||
{
|
{
|
||||||
private readonly IConfiguration _configuration;
|
public static void ConfigureServices(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
|
||||||
public Startup(IConfiguration configuration)
|
|
||||||
{
|
|
||||||
_configuration = configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string AgentCode => _configuration.GetValue<string>("Agent:Code");
|
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
|
||||||
{
|
{
|
||||||
services.AddControllers()
|
services.AddControllers()
|
||||||
.AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc);
|
.AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc);
|
||||||
|
|
||||||
// Add basic authentication
|
// Add basic authentication
|
||||||
services.AddIdentityAuthentication(_configuration.GetSection("IdentityServer")["BaseAddress"]);
|
services.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]);
|
||||||
|
|
||||||
// MediatR
|
// MediatR
|
||||||
services.AddMediatR(GetMediatRAssemblies());
|
services.AddMediatR(GetMediatRAssemblies());
|
||||||
|
@ -43,7 +31,8 @@ namespace NetworkResurrector.Agent
|
||||||
services.AddAutoMapper(typeof(Application.Mappings.MappingProfile).Assembly);
|
services.AddAutoMapper(typeof(Application.Mappings.MappingProfile).Assembly);
|
||||||
|
|
||||||
// Swagger
|
// Swagger
|
||||||
services.AddSwagger($"NetworkResurrectorAgent {AgentCode}", AuthorizationType.InhouseIdentity);
|
var agentCode = configuration.GetValue<string>("Agent:Code");
|
||||||
|
services.AddSwagger($"NetworkResurrectorAgent {agentCode}", AuthorizationType.InhouseIdentity);
|
||||||
|
|
||||||
// Data access
|
// Data access
|
||||||
// services.AddDataAccess();
|
// services.AddDataAccess();
|
||||||
|
@ -52,14 +41,14 @@ namespace NetworkResurrector.Agent
|
||||||
services.AddApplicationServices();
|
services.AddApplicationServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Assembly[] GetMediatRAssemblies()
|
private static Assembly[] GetMediatRAssemblies()
|
||||||
{
|
{
|
||||||
var assembly = typeof(Application.Queries.GetSystemVersion).Assembly;
|
var assembly = typeof(Application.Queries.GetSystemVersion).Assembly;
|
||||||
return new Assembly[] { assembly };
|
return new Assembly[] { assembly };
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public static void Configure(this IApplicationBuilder app, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
// global cors policy
|
// global cors policy
|
||||||
app.UseCors(x => x
|
app.UseCors(x => x
|
||||||
|
@ -67,11 +56,6 @@ namespace NetworkResurrector.Agent
|
||||||
.AllowAnyMethod()
|
.AllowAnyMethod()
|
||||||
.AllowAnyHeader());
|
.AllowAnyHeader());
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseDeveloperExceptionPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
@ -79,7 +63,9 @@ namespace NetworkResurrector.Agent
|
||||||
{
|
{
|
||||||
endpoints.MapControllers();
|
endpoints.MapControllers();
|
||||||
});
|
});
|
||||||
app.ConfigureSwagger($"NetworkResurrectorAgent {AgentCode}");
|
|
||||||
|
var agentCode = configuration.GetValue<string>("Agent:Code");
|
||||||
|
app.ConfigureSwagger($"NetworkResurrectorAgent {agentCode}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -10,8 +10,8 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="NDB.Extensions.Swagger" Version="$(NDBExtensionsSwaggerPackageVersion)" />
|
<PackageReference Include="Netmash.Extensions.Swagger" Version="$(NetmashExtensionsSwaggerPackageVersion)" />
|
||||||
<PackageReference Include="NDB.Security.Authentication.Identity" Version="$(NDBSecurityAuthenticationPackageVersion)" />
|
<PackageReference Include="Netmash.Security.Authentication.Identity" Version="$(NetmashSecurityAuthenticationPackageVersion)" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />
|
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsPackageVersion)" />
|
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsolePackageVersion)" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsolePackageVersion)" />
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using NetworkResurrector.Agent.Extensions;
|
||||||
using NetworkResurrector.Agent.Extensions.Serilog;
|
using NetworkResurrector.Agent.Extensions.Serilog;
|
||||||
using NetworkResurrector.Agent.Extensions.Serilog.Sinks.MSSqlServer;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using Serilog.Sinks.MSSqlServer;
|
using Serilog.Sinks.MSSqlServer;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace NetworkResurrector.Agent
|
namespace NetworkResurrector.Agent
|
||||||
{
|
{
|
||||||
|
@ -18,76 +16,65 @@ namespace NetworkResurrector.Agent
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var isConsole = Debugger.IsAttached || args.Contains("--console");
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
if (!isConsole)
|
|
||||||
|
builder.Host.UseSerilog((_, lc) =>
|
||||||
{
|
{
|
||||||
var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
|
var connectionString = builder.Configuration.GetConnectionString("DatabaseConnection");
|
||||||
var pathToContentRoot = Path.GetDirectoryName(pathToExe);
|
var loggingLevelParam = builder.Configuration.GetValue<string>("Logging:LogLevel:Default");
|
||||||
Directory.SetCurrentDirectory(pathToContentRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
var configuration = new ConfigurationBuilder()
|
var loggingLevelOk = Enum.TryParse(loggingLevelParam, out LogEventLevel loggingLevel);
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
if (!loggingLevelOk)
|
||||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
throw new Exception($"Logging level '{loggingLevelParam}' is not valid.");
|
||||||
.AddEnvironmentVariables()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var connectionString = configuration.GetConnectionString("DatabaseConnection");
|
var loggingLevelSwitch = new LoggingLevelSwitch(loggingLevel);
|
||||||
var loggingLevelParam = configuration.GetValue<string>("Logging:LogLevel:Default");
|
|
||||||
|
|
||||||
var loggingLevelOk = Enum.TryParse(loggingLevelParam, out LogEventLevel loggingLevel);
|
var columnOptions = new ColumnOptions();
|
||||||
if (!loggingLevelOk)
|
columnOptions.Store.Remove(StandardColumn.Properties);
|
||||||
throw new Exception($"Logging level '{loggingLevelParam}' is not valid.");
|
columnOptions.Store.Remove(StandardColumn.MessageTemplate);
|
||||||
|
columnOptions.Store.Add(StandardColumn.LogEvent);
|
||||||
|
var mssqlSinkOptions = new MSSqlServerSinkOptions() { AutoCreateSqlTable = true, TableName = "__Logs_Agent" };
|
||||||
|
|
||||||
var loggingLevelSwitch = new LoggingLevelSwitch(loggingLevel);
|
lc
|
||||||
|
|
||||||
var columnOptions = new ColumnOptions().AsStandard();
|
|
||||||
var mssqlSinkOptions = new MSSqlServerSinkOptions() { AutoCreateSqlTable = true, TableName = "__Logs_Agent" };
|
|
||||||
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
|
||||||
.MinimumLevel.ControlledBy(loggingLevelSwitch)
|
.MinimumLevel.ControlledBy(loggingLevelSwitch)
|
||||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
.Enrich.With(new AgentCodeEventEnricher(configuration))
|
.Enrich.With(new AgentCodeEventEnricher(builder.Configuration))
|
||||||
.WriteTo.Console()
|
.WriteTo.Console()
|
||||||
.WriteTo.MSSqlServer(connectionString, mssqlSinkOptions, columnOptions: columnOptions)
|
.WriteTo.MSSqlServer(connectionString, mssqlSinkOptions, columnOptions: columnOptions);
|
||||||
.CreateLogger();
|
});
|
||||||
|
|
||||||
|
builder.Services.ConfigureServices(builder.Configuration);
|
||||||
|
|
||||||
|
var useWindowsService = builder.Configuration.GetValue<bool>("Host:UseWindowsService");
|
||||||
|
if (useWindowsService)
|
||||||
|
builder.Host.UseWindowsService();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
app.Configure(builder.Configuration);
|
||||||
|
|
||||||
|
var exitCode = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var urls = configuration.GetValue<string>("Urls");
|
var urls = builder.Configuration.GetValue<string>("Urls");
|
||||||
var agentCode = configuration.GetValue<string>("Agent:Code");
|
var agentCode = builder.Configuration.GetValue<string>("Agent:Code");
|
||||||
|
|
||||||
Log.Information($"Starting network resurrector agent {agentCode}...");
|
Log.Information($"Starting network resurrector agent {agentCode}...");
|
||||||
Log.Information($"Network resurrector agent {agentCode} listening on {urls}");
|
Log.Information($"Network resurrector agent {agentCode} listening on {urls}");
|
||||||
Log.Information($"Hostname: {Environment.MachineName}");
|
Log.Information($"Hostname: {Environment.MachineName}");
|
||||||
Console.WriteLine("Application started. Press Ctrl+C to shut down.");
|
Console.WriteLine("Application started. Press Ctrl+C to shut down.");
|
||||||
CreateHostBuilder(args, configuration, !isConsole).Build().Run();
|
app.Run();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Fatal(ex, "Network resurrector agent host terminated unexpectedly");
|
Log.Fatal(ex, "Network resurrector agent host terminated unexpectedly");
|
||||||
|
exitCode = 1;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Log.CloseAndFlush();
|
Log.CloseAndFlush();
|
||||||
}
|
}
|
||||||
}
|
Environment.Exit(exitCode);
|
||||||
|
|
||||||
public static IHostBuilder CreateHostBuilder(string[] args, IConfiguration configuration, bool useWindowsService)
|
|
||||||
{
|
|
||||||
var builder = Host.CreateDefaultBuilder(args)
|
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
|
||||||
{
|
|
||||||
webBuilder.UseStartup<Startup>()
|
|
||||||
.UseConfiguration(configuration)
|
|
||||||
.UseSerilog();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (useWindowsService)
|
|
||||||
builder.UseWindowsService();
|
|
||||||
|
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
-->
|
-->
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<DeleteExistingFiles>False</DeleteExistingFiles>
|
<DeleteExistingFiles>false</DeleteExistingFiles>
|
||||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
<PublishProvider>FileSystem</PublishProvider>
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
<PublishUrl>bin\Release\net5.0\publish\</PublishUrl>
|
<PublishUrl>bin\Release\net5.0\publish\</PublishUrl>
|
||||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
<SiteUrlToLaunchAfterPublish />
|
<SiteUrlToLaunchAfterPublish />
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<ProjectGuid>c8c4ca6f-39e2-46fe-89e2-0a81d2f4161e</ProjectGuid>
|
<ProjectGuid>c8c4ca6f-39e2-46fe-89e2-0a81d2f4161e</ProjectGuid>
|
||||||
<SelfContained>true</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft": "Warning",
|
|
||||||
"Microsoft.Hosting.Lifetime": "Information"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,6 +3,9 @@
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DatabaseConnection": "Server=#########;Database=#########;User Id=#########;Password=#########;MultipleActiveResultSets=true"
|
"DatabaseConnection": "Server=#########;Database=#########;User Id=#########;Password=#########;MultipleActiveResultSets=true"
|
||||||
},
|
},
|
||||||
|
"Host": {
|
||||||
|
"UseWindowsService": true
|
||||||
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Debug",
|
"Default": "Debug",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="NDB.Application.DataContracts" Version="$(NDBApplicationPackageVersion)" />
|
<PackageReference Include="Netmash.Application.DataContracts" Version="$(NetmashApplicationPackageVersion)" />
|
||||||
<PackageReference Include="NetworkResurrector.Agent.Wrapper" Version="1.0.3.1" />
|
<PackageReference Include="NetworkResurrector.Agent.Wrapper" Version="1.0.3.1" />
|
||||||
<PackageReference Include="NetworkResurrector.Server.Wrapper" Version="1.0.3.3" />
|
<PackageReference Include="NetworkResurrector.Server.Wrapper" Version="1.0.3.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Api.Domain.Repositories;
|
using NetworkResurrector.Api.Domain.Repositories;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Api.PublishedLanguage.Events;
|
using NetworkResurrector.Api.PublishedLanguage.Events;
|
||||||
|
|
||||||
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Api.PublishedLanguage.Events;
|
using NetworkResurrector.Api.PublishedLanguage.Events;
|
||||||
|
|
||||||
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Api.PublishedLanguage.Events;
|
using NetworkResurrector.Api.PublishedLanguage.Events;
|
||||||
|
|
||||||
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Api.PublishedLanguage.Events;
|
using NetworkResurrector.Api.PublishedLanguage.Events;
|
||||||
|
|
||||||
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Api.PublishedLanguage.Events;
|
using NetworkResurrector.Api.PublishedLanguage.Events;
|
||||||
|
|
||||||
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Api.PublishedLanguage.Events;
|
using NetworkResurrector.Api.PublishedLanguage.Events;
|
||||||
|
|
||||||
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Api.PublishedLanguage.Events;
|
using NetworkResurrector.Api.PublishedLanguage.Events;
|
||||||
|
|
||||||
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Api.PublishedLanguage.Events;
|
using NetworkResurrector.Api.PublishedLanguage.Events;
|
||||||
|
|
||||||
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
namespace NetworkResurrector.Api.PublishedLanguage.Commands
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NDB.Application.DataContracts" Version="$(NDBApplicationPackageVersion)" />
|
<PackageReference Include="Netmash.Application.DataContracts" Version="$(NetmashApplicationPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
|
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY dependencies.props .
|
COPY dependencies.props .
|
||||||
COPY Directory.Build.props .
|
COPY Directory.Build.props .
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using MediatR.Pipeline;
|
using MediatR.Pipeline;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using NDB.Extensions.Swagger;
|
using Netmash.Extensions.Swagger;
|
||||||
using NDB.Extensions.Swagger.Constants;
|
using Netmash.Extensions.Swagger.Constants;
|
||||||
using NDB.Infrastructure.DatabaseMigration;
|
using Netmash.Infrastructure.DatabaseMigration;
|
||||||
using NDB.Infrastructure.DatabaseMigration.Constants;
|
using Netmash.Infrastructure.DatabaseMigration.Constants;
|
||||||
using NDB.Security.Authentication.Identity;
|
using Netmash.Security.Authentication.Identity;
|
||||||
using NetworkResurrector.Agent.Wrapper;
|
using NetworkResurrector.Agent.Wrapper;
|
||||||
using NetworkResurrector.Api.Application;
|
using NetworkResurrector.Api.Application;
|
||||||
using NetworkResurrector.Api.Domain.Abstractions;
|
using NetworkResurrector.Api.Domain.Abstractions;
|
||||||
|
@ -18,25 +17,17 @@ using NetworkResurrector.Server.Wrapper;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace NetworkResurrector.Api
|
namespace NetworkResurrector.Api.Extensions
|
||||||
{
|
{
|
||||||
public class Startup
|
public static class StartupExtensions
|
||||||
{
|
{
|
||||||
private readonly IConfiguration _configuration;
|
public static void ConfigureServices(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
|
||||||
public Startup(IConfiguration configuration)
|
|
||||||
{
|
|
||||||
_configuration = configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
|
||||||
{
|
{
|
||||||
services.AddControllers()
|
services.AddControllers()
|
||||||
.AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc);
|
.AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc);
|
||||||
|
|
||||||
// Add basic authentication
|
// Add basic authentication
|
||||||
services.AddIdentityAuthentication(_configuration.GetSection("IdentityServer")["BaseAddress"]);
|
services.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]);
|
||||||
|
|
||||||
services.AddHttpContextAccessor();
|
services.AddHttpContextAccessor();
|
||||||
services.AddScoped<IUserService, UserService>();
|
services.AddScoped<IUserService, UserService>();
|
||||||
|
@ -53,7 +44,7 @@ namespace NetworkResurrector.Api
|
||||||
services.AddSwagger("NetworkResurrector API", AuthorizationType.InhouseIdentity);
|
services.AddSwagger("NetworkResurrector API", AuthorizationType.InhouseIdentity);
|
||||||
|
|
||||||
// Add network resurrector server services
|
// Add network resurrector server services
|
||||||
services.UseResurrectorServices(_configuration.GetSection("NetworkResurrectorServer")["BaseAddress"]);
|
services.UseResurrectorServices(configuration.GetSection("NetworkResurrectorServer")["BaseAddress"]);
|
||||||
|
|
||||||
// Add network resurrector agent services
|
// Add network resurrector agent services
|
||||||
services.UseResurrectorAgentServices();
|
services.UseResurrectorAgentServices();
|
||||||
|
@ -66,14 +57,13 @@ namespace NetworkResurrector.Api
|
||||||
services.AddApplicationServices();
|
services.AddApplicationServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Assembly[] GetMediatRAssemblies()
|
private static Assembly[] GetMediatRAssemblies()
|
||||||
{
|
{
|
||||||
var assembly = typeof(Application.Queries.GetMachines).Assembly;
|
var assembly = typeof(Application.Queries.GetMachines).Assembly;
|
||||||
return new Assembly[] { assembly };
|
return new Assembly[] { assembly };
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
public static void Configure(this IApplicationBuilder app)
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
||||||
{
|
{
|
||||||
// global cors policy
|
// global cors policy
|
||||||
app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
|
app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="NDB.Extensions.Swagger" Version="$(NDBExtensionsSwaggerPackageVersion)" />
|
<PackageReference Include="Netmash.Extensions.Swagger" Version="$(NetmashExtensionsSwaggerPackageVersion)" />
|
||||||
<PackageReference Include="NDB.Infrastructure.DatabaseMigration" Version="$(NDBDatabaseMigrationPackageVersion)" />
|
<PackageReference Include="Netmash.Infrastructure.DatabaseMigration" Version="$(NetmashDatabaseMigrationPackageVersion)" />
|
||||||
<PackageReference Include="NDB.Security.Authentication.Identity" Version="$(NDBSecurityAuthenticationPackageVersion)" />
|
<PackageReference Include="Netmash.Security.Authentication.Identity" Version="$(NetmashSecurityAuthenticationPackageVersion)" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />
|
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsPackageVersion)" />
|
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsolePackageVersion)" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsolePackageVersion)" />
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
Docker commands:
|
|
||||||
*****************
|
|
||||||
|
|
||||||
Create image:
|
|
||||||
--from solution folder:
|
|
||||||
docker image build -t "network-resurrector-api:1.0.1" -f "src/api/NetworkResurrector.Api/Docker/amd64/Dockerfile" .
|
|
||||||
|
|
||||||
Run image:
|
|
||||||
docker run -p 5053:80 -it network-resurrector-api:1.0.1
|
|
||||||
|
|
||||||
Push image to registry:
|
|
||||||
--tag image
|
|
||||||
docker tag network-resurrector-api:1.0.1 alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1
|
|
||||||
|
|
||||||
--login to registry
|
|
||||||
docker login --username=admin --password="*********" alpine-nexus:8500
|
|
||||||
|
|
||||||
--push image
|
|
||||||
docker push alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1
|
|
||||||
|
|
||||||
Pull image from registry
|
|
||||||
--login to registry
|
|
||||||
|
|
||||||
--pull image
|
|
||||||
docker pull alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1
|
|
||||||
|
|
||||||
Stop old container
|
|
||||||
docker stop network-resurrector-api
|
|
||||||
docker rm network-resurrector-api
|
|
||||||
|
|
||||||
Run container in prod env
|
|
||||||
docker run -d --name network-resurrector-api --restart=always -p 5008:80 alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1
|
|
||||||
docker run -d --name network-resurrector-api --restart=always -p 5008:80 tstanciu/sta-registry:nr-api-1.0.1-arm
|
|
||||||
|
|
||||||
Remove old image
|
|
||||||
docker rmi alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.0
|
|
||||||
|
|
||||||
#######################################################################################################################################################
|
|
||||||
Docker container last version: 1.0.1
|
|
||||||
##############################################################################################
|
|
|
@ -1,33 +0,0 @@
|
||||||
Docker commands:
|
|
||||||
*****************
|
|
||||||
|
|
||||||
Create image and push it:
|
|
||||||
--login to registry
|
|
||||||
docker login --username=tstanciu --password="*********"
|
|
||||||
|
|
||||||
--from solution folder:
|
|
||||||
docker buildx build --platform linux/arm/v7 -t "tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7" -f "src/api/NetworkResurrector.Api/Docker/arm32/Dockerfile" --push .
|
|
||||||
|
|
||||||
# With insecure registry
|
|
||||||
docker buildx build --platform linux/arm/v7 -t "alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1-arm" -f "src/api/NetworkResurrector.Api/Docker/arm32v7/Dockerfile" --push .
|
|
||||||
https://docs.docker.com/engine/reference/commandline/buildx_create/
|
|
||||||
https://stackoverflow.com/questions/63409755/how-to-use-docker-buildx-pushing-image-to-registry-use-http-protocol
|
|
||||||
|
|
||||||
|
|
||||||
Pull image from registry
|
|
||||||
--login to registry
|
|
||||||
|
|
||||||
--pull image
|
|
||||||
docker pull tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7
|
|
||||||
|
|
||||||
Stop old container
|
|
||||||
docker stop network-resurrector-api && docker rm network-resurrector-api
|
|
||||||
|
|
||||||
Run container in prod env
|
|
||||||
docker run -d --name network-resurrector-api --restart=always -p 5008:80 tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7
|
|
||||||
|
|
||||||
Remove old image
|
|
||||||
docker rmi tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7
|
|
||||||
|
|
||||||
docker run -d --name network-resurrector-api --restart=always -p 5008:80 alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1
|
|
||||||
#######################################################################################################################################################
|
|
|
@ -1,14 +1,13 @@
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using NetworkResurrector.Api.Extensions;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using Serilog.Sinks.MSSqlServer;
|
using Serilog.Sinks.MSSqlServer;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace NetworkResurrector.Api
|
namespace NetworkResurrector.Api
|
||||||
{
|
{
|
||||||
|
@ -16,76 +15,58 @@ namespace NetworkResurrector.Api
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var isConsole = args.Contains("--console");
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
if (!isConsole)
|
|
||||||
|
builder.Host.UseSerilog((_, lc) =>
|
||||||
{
|
{
|
||||||
var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
|
var connectionString = builder.Configuration.GetConnectionString("DatabaseConnection");
|
||||||
var pathToContentRoot = Path.GetDirectoryName(pathToExe);
|
var loggingLevelParam = builder.Configuration.GetValue<string>("Logging:LogLevel:Default");
|
||||||
Directory.SetCurrentDirectory(pathToContentRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
var configuration = new ConfigurationBuilder()
|
var loggingLevelOk = Enum.TryParse(loggingLevelParam, out LogEventLevel loggingLevel);
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
if (!loggingLevelOk)
|
||||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
throw new Exception($"Logging level '{loggingLevelParam}' is not valid.");
|
||||||
.AddEnvironmentVariables()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var connectionString = configuration.GetConnectionString("DatabaseConnection");
|
var loggingLevelSwitch = new LoggingLevelSwitch(loggingLevel);
|
||||||
var loggingLevelParam = configuration.GetValue<string>("Logging:LogLevel:Default");
|
|
||||||
|
|
||||||
var loggingLevelOk = Enum.TryParse(loggingLevelParam, out LogEventLevel loggingLevel);
|
var columnOptions = new ColumnOptions();
|
||||||
if (!loggingLevelOk)
|
columnOptions.Store.Remove(StandardColumn.Properties);
|
||||||
throw new Exception($"Logging level '{loggingLevelParam}' is not valid.");
|
columnOptions.Store.Remove(StandardColumn.MessageTemplate);
|
||||||
|
columnOptions.Store.Add(StandardColumn.LogEvent);
|
||||||
|
var mssqlSinkOptions = new MSSqlServerSinkOptions() { AutoCreateSqlTable = true, TableName = "__Logs" };
|
||||||
|
|
||||||
var loggingLevelSwitch = new LoggingLevelSwitch(loggingLevel);
|
lc
|
||||||
|
|
||||||
var columnOptions = new ColumnOptions();
|
|
||||||
columnOptions.Store.Remove(StandardColumn.Properties);
|
|
||||||
columnOptions.Store.Remove(StandardColumn.MessageTemplate);
|
|
||||||
columnOptions.Store.Add(StandardColumn.LogEvent);
|
|
||||||
|
|
||||||
var mssqlSinkOptions = new MSSqlServerSinkOptions() { AutoCreateSqlTable = true, TableName = "__Logs" };
|
|
||||||
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
|
||||||
.MinimumLevel.ControlledBy(loggingLevelSwitch)
|
.MinimumLevel.ControlledBy(loggingLevelSwitch)
|
||||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
.WriteTo.Console()
|
.WriteTo.Console()
|
||||||
.WriteTo.MSSqlServer(connectionString, mssqlSinkOptions, columnOptions: columnOptions)
|
.WriteTo.MSSqlServer(connectionString, mssqlSinkOptions, columnOptions: columnOptions);
|
||||||
.CreateLogger();
|
});
|
||||||
|
|
||||||
|
builder.Services.ConfigureServices(builder.Configuration);
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
app.Configure();
|
||||||
|
|
||||||
|
var exitCode = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var urls = configuration.GetValue<string>("urls");
|
var urls = builder.Configuration.GetValue<string>("urls");
|
||||||
Log.Information("Starting network resurrector API...");
|
Log.Information("Starting network resurrector API...");
|
||||||
Log.Information($"Network resurrector API listening on {urls}");
|
Log.Information($"Network resurrector API listening on {urls}");
|
||||||
Console.WriteLine("Application started. Press Ctrl+C to shut down.");
|
Console.WriteLine("Application started. Press Ctrl+C to shut down.");
|
||||||
CreateHostBuilder(args, configuration, !isConsole).Build().Run();
|
|
||||||
|
app.Run();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Fatal(ex, "Network resurrector API host terminated unexpectedly");
|
Log.Fatal(ex, "Network resurrector API host terminated unexpectedly");
|
||||||
|
exitCode = 1;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Log.CloseAndFlush();
|
Log.CloseAndFlush();
|
||||||
}
|
}
|
||||||
}
|
Environment.Exit(exitCode);
|
||||||
|
|
||||||
public static IHostBuilder CreateHostBuilder(string[] args, IConfiguration configuration, bool useWindowsService)
|
|
||||||
{
|
|
||||||
var builder = Host.CreateDefaultBuilder(args)
|
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
|
||||||
{
|
|
||||||
webBuilder.UseStartup<Startup>()
|
|
||||||
.UseConfiguration(configuration)
|
|
||||||
.UseSerilog();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (useWindowsService)
|
|
||||||
builder.UseWindowsService();
|
|
||||||
|
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace NetworkResurrector.Api.Services
|
||||||
|
|
||||||
public bool UserIsGuest()
|
public bool UserIsGuest()
|
||||||
{
|
{
|
||||||
var userIsGuest = _httpAccessor.HttpContext.User?.Claims.FirstOrDefault(z => z.Type == NDB.Security.Authentication.Identity.Constants.ClaimTypes.IsGuestUser)?.Value;
|
var userIsGuest = _httpAccessor.HttpContext.User?.Claims.FirstOrDefault(z => z.Type == Netmash.Security.Authentication.Identity.Constants.ClaimTypes.IsGuestUser)?.Value;
|
||||||
return !string.IsNullOrEmpty(userIsGuest) && bool.TrueString == userIsGuest;
|
return !string.IsNullOrEmpty(userIsGuest) && bool.TrueString == userIsGuest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Server.PublishedLanguage.Events;
|
using NetworkResurrector.Server.PublishedLanguage.Events;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Server.PublishedLanguage.Events;
|
using NetworkResurrector.Server.PublishedLanguage.Events;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NDB.Application.DataContracts;
|
using Netmash.Application.DataContracts;
|
||||||
using NetworkResurrector.Server.PublishedLanguage.Events;
|
using NetworkResurrector.Server.PublishedLanguage.Events;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Description>Network resurrector server published language nuget package</Description>
|
<Description>Network resurrector server published language nuget package</Description>
|
||||||
<RepositoryUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</RepositoryUrl>
|
<RepositoryUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
|
@ -10,6 +10,6 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NDB.Application.DataContracts" Version="$(NDBApplicationPackageVersion)" />
|
<PackageReference Include="Netmash.Application.DataContracts" Version="$(NetmashApplicationPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Description>Network resurrector server wrapper nuget package</Description>
|
<Description>Network resurrector server wrapper nuget package</Description>
|
||||||
<PackageProjectUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</PackageProjectUrl>
|
<PackageProjectUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</PackageProjectUrl>
|
||||||
<RepositoryUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</RepositoryUrl>
|
<RepositoryUrl>https://dev.azure.com/tstanciu94/NetworkResurrector</RepositoryUrl>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -10,8 +10,8 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="NDB.Extensions.Swagger" Version="$(NDBExtensionsSwaggerPackageVersion)" />
|
<PackageReference Include="Netmash.Extensions.Swagger" Version="$(NetmashExtensionsSwaggerPackageVersion)" />
|
||||||
<PackageReference Include="NDB.Security.Authentication.Identity" Version="$(NDBSecurityAuthenticationPackageVersion)" />
|
<PackageReference Include="Netmash.Security.Authentication.Identity" Version="$(NetmashSecurityAuthenticationPackageVersion)" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />
|
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsPackageVersion)" />
|
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsPackageVersion)" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsolePackageVersion)" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsolePackageVersion)" />
|
||||||
|
|
|
@ -4,16 +4,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
-->
|
-->
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<DeleteExistingFiles>False</DeleteExistingFiles>
|
<DeleteExistingFiles>false</DeleteExistingFiles>
|
||||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
<PublishProvider>FileSystem</PublishProvider>
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
<PublishUrl>bin\Release\net5.0\publish\</PublishUrl>
|
<PublishUrl>bin\Release\net5.0\publish\</PublishUrl>
|
||||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
<SiteUrlToLaunchAfterPublish />
|
<SiteUrlToLaunchAfterPublish />
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<ProjectGuid>f6600491-5d79-4548-8745-59d9d337d3db</ProjectGuid>
|
<ProjectGuid>f6600491-5d79-4548-8745-59d9d337d3db</ProjectGuid>
|
||||||
<SelfContained>true</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
|
|
|
@ -5,9 +5,9 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using NDB.Extensions.Swagger;
|
using Netmash.Extensions.Swagger;
|
||||||
using NDB.Extensions.Swagger.Constants;
|
using Netmash.Extensions.Swagger.Constants;
|
||||||
using NDB.Security.Authentication.Identity;
|
using Netmash.Security.Authentication.Identity;
|
||||||
using NetworkResurrector.Server.Application;
|
using NetworkResurrector.Server.Application;
|
||||||
using NetworkResurrector.Server.Extensions;
|
using NetworkResurrector.Server.Extensions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
@ -45,7 +45,7 @@ namespace NetworkResurrector.Server
|
||||||
typeof(Application.Mappings.MappingProfile).Assembly);
|
typeof(Application.Mappings.MappingProfile).Assembly);
|
||||||
|
|
||||||
// Swagger
|
// Swagger
|
||||||
services.AddSwagger("NetworkResurrector API", AuthorizationType.InhouseIdentity);
|
services.AddSwagger("NetworkResurrector Server API", AuthorizationType.InhouseIdentity);
|
||||||
|
|
||||||
// Application
|
// Application
|
||||||
services.AddApplicationServices();
|
services.AddApplicationServices();
|
||||||
|
@ -75,7 +75,7 @@ namespace NetworkResurrector.Server
|
||||||
{
|
{
|
||||||
endpoints.MapControllers();
|
endpoints.MapControllers();
|
||||||
});
|
});
|
||||||
app.ConfigureSwagger("NetworkResurrector API");
|
app.ConfigureSwagger("NetworkResurrector Server API");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Assembly[] GetMediatRAssemblies()
|
private Assembly[] GetMediatRAssemblies()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Reference in New Issue