Commented out local configuration, to avoid exception
This commit is contained in:
parent
942fcdf9fc
commit
5c2b145ec2
@ -1,17 +1,19 @@
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace WebStatus
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static readonly string Namespace = typeof(Program).Namespace;
|
||||
public static readonly string AppName = Namespace;
|
||||
public static readonly string Namespace = typeof(Program).Namespace;
|
||||
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
@ -24,6 +26,8 @@ namespace WebStatus
|
||||
Log.Information("Configuring web host ({ApplicationContext})...", AppName);
|
||||
var host = BuildWebHost(configuration, args);
|
||||
|
||||
LogPackagesVersionInfo();
|
||||
|
||||
Log.Information("Starting web host ({ApplicationContext})...", AppName);
|
||||
host.Run();
|
||||
|
||||
@ -83,5 +87,39 @@ namespace WebStatus
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
private static string GetVersion(Assembly assembly)
|
||||
{
|
||||
try
|
||||
{
|
||||
return $"{assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version} ({assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Split()[0]})";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static void LogPackagesVersionInfo()
|
||||
{
|
||||
var assemblies = new List<Assembly>();
|
||||
|
||||
foreach (var dependencyName in typeof(Program).Assembly.GetReferencedAssemblies())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Try to load the referenced assembly...
|
||||
assemblies.Add(Assembly.Load(dependencyName));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Failed to load assembly. Skip it.
|
||||
}
|
||||
}
|
||||
|
||||
var versionList = assemblies.Select(a => $"-{a.GetName().Name} - {GetVersion(a)}").OrderBy(value => value);
|
||||
|
||||
Log.Logger.ForContext("PackageVersions", string.Join("\n", versionList)).Information("Package versions ({ApplicationContext})", AppName);
|
||||
}
|
||||
}
|
||||
}
|
@ -11,9 +11,9 @@
|
||||
<None Remove="Views\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="2.2.8" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="2.2.19" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="2.2.2" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="2.2.0" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="2.2.2" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.2.1" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.6.1" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.2" />
|
||||
@ -24,7 +24,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="1.0.172" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
|
||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.2" />
|
||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" />
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"HealthChecks-UI": {
|
||||
"HealthChecks-UI-commented-out": {
|
||||
"HealthChecks": [
|
||||
{
|
||||
"Name": "Ordering HTTP Check",
|
||||
@ -70,14 +70,6 @@
|
||||
"Uri": "http://localhost:5121/hc"
|
||||
}
|
||||
],
|
||||
"Webhooks": [
|
||||
{
|
||||
"Name": "",
|
||||
"Uri": "",
|
||||
"Payload": "",
|
||||
"RestoredPayload": ""
|
||||
}
|
||||
],
|
||||
"EvaluationTimeOnSeconds": 10,
|
||||
"MinimumSecondsBetweenFailureNotifications": 60
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user