diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 283cf6c..2d64ae7 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
WebDoorCreator - Egalware
- Version: 0.9.2404.2311
+ Version: 0.9.2404.2315
Release note:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index 0de4d59..8a864dd 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-0.9.2404.2311
+0.9.2404.2315
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index be6c022..fed505c 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 0.9.2404.2311
+ 0.9.2404.2315
http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip
http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html
false
diff --git a/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-PROD.pubxml b/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS01.pubxml
similarity index 100%
rename from WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-PROD.pubxml
rename to WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS01.pubxml
diff --git a/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-PROD.pubxml.user b/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS01.pubxml.user
similarity index 100%
rename from WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-PROD.pubxml.user
rename to WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS01.pubxml.user
diff --git a/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS02.pubxml b/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS02.pubxml
new file mode 100644
index 0000000..9e088b1
--- /dev/null
+++ b/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS02.pubxml
@@ -0,0 +1,27 @@
+
+
+
+
+ MSDeploy
+ true
+ Release
+ Any CPU
+ https://wdc.egalware.com/UI/swagger/index.html
+ false
+ c2109e71-4eae-4167-9052-175123ccc2bc
+ false
+ https://wdc-w-iis-02.ovh:8172/MsDeploy.axd
+ wdc.egalware.com/SRV
+
+ false
+ WMSVC
+ true
+ true
+ steamware
+ <_SavePWD>true
+ <_TargetId>IISWebDeploy
+ net6.0
+
+
\ No newline at end of file
diff --git a/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS02.pubxml.user b/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS02.pubxml.user
new file mode 100644
index 0000000..be3bb02
--- /dev/null
+++ b/WebDoorCreator.API/Properties/PublishProfiles/IIS-OVH-IIS02.pubxml.user
@@ -0,0 +1,13 @@
+
+
+
+
+
+ AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAs/7D3mNhw0uqUXeNq4OiHAAAAAACAAAAAAADZgAAwAAAABAAAACWZ0w5h84UFtYYB4xT+4rFAAAAAASAAACgAAAAEAAAAIcwjcdAiCDZN1OwNWoZSfQYAAAAiyiNcp/zeuC6Vt16+OALvsaO0rbkiVMVFAAAAHS264wElPIM4sYvPHMhW0YsXNe9
+ True|2024-04-19T17:27:31.3742108Z;False|2024-04-19T16:51:43.3272308+02:00;False|2024-04-19T16:41:46.2086401+02:00;False|2024-04-19T16:41:31.3019711+02:00;False|2024-04-19T16:08:22.4275238+02:00;False|2024-04-19T16:05:18.6039531+02:00;False|2024-04-19T15:59:02.0838144+02:00;True|2024-02-15T19:34:35.8362293+01:00;False|2024-02-15T19:33:47.6399861+01:00;True|2024-02-13T17:40:01.6315651+01:00;False|2024-02-13T17:37:21.2072257+01:00;False|2024-02-13T17:33:33.1471911+01:00;True|2023-05-22T15:37:00.8611764+02:00;True|2023-05-11T17:35:09.5858697+02:00;True|2022-01-27T10:34:09.2346456+01:00;True|2022-01-27T10:13:36.3080675+01:00;True|2022-01-27T10:05:45.6649507+01:00;True|2022-01-26T14:34:16.5263189+01:00;True|2022-01-26T13:04:22.2336648+01:00;False|2022-01-26T13:04:06.0677616+01:00;True|2021-11-08T09:03:37.7855257+01:00;True|2021-11-08T09:03:34.8263479+01:00;True|2021-11-08T09:03:31.8889390+01:00;True|2021-10-29T16:19:33.6539408+02:00;True|2021-10-29T16:19:28.2082360+02:00;True|2021-10-26T16:12:11.7740950+02:00;True|2021-10-26T16:11:56.2014641+02:00;True|2021-10-26T16:11:22.2897842+02:00;False|2021-10-26T16:10:58.3733037+02:00;False|2021-10-26T16:10:29.4793991+02:00;True|2021-10-21T17:35:11.9761128+02:00;True|2021-10-18T20:22:00.9305399+02:00;True|2021-10-18T18:32:29.4558070+02:00;True|2021-10-18T18:32:22.8950294+02:00;True|2021-10-18T18:16:13.7563877+02:00;True|2021-10-18T18:15:48.5678387+02:00;True|2021-10-18T12:45:45.7228681+02:00;True|2021-10-18T12:14:22.3221605+02:00;True|2021-10-18T12:14:15.7373530+02:00;True|2021-10-18T12:10:43.8607301+02:00;
+
+
+
\ No newline at end of file
diff --git a/WebDoorCreator.API/WebDoorCreator.API.csproj b/WebDoorCreator.API/WebDoorCreator.API.csproj
index 0b66688..bbcf09b 100644
--- a/WebDoorCreator.API/WebDoorCreator.API.csproj
+++ b/WebDoorCreator.API/WebDoorCreator.API.csproj
@@ -8,8 +8,9 @@
+ <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-IIS01.pubxml" />
+ <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-IIS02.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-PROD-test.pubxml" />
- <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
@@ -17,8 +18,9 @@
+
-
+
diff --git a/WebDoorCreator.UI/Health/Checks.cs b/WebDoorCreator.UI/Health/Checks.cs
new file mode 100644
index 0000000..d08cd70
--- /dev/null
+++ b/WebDoorCreator.UI/Health/Checks.cs
@@ -0,0 +1,127 @@
+using Microsoft.Extensions.Diagnostics.HealthChecks;
+using NLog;
+using System.Net.NetworkInformation;
+
+namespace WebDoorCreator.UI.Health
+{
+ public class Checks
+ {
+ #region Private Fields
+
+ private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
+
+ #endregion Private Fields
+
+ #region Public Methods
+
+ public static async Task DbIdentity(string dbName)
+ {
+ string description = "Try check Table IdentityUsers";
+ var healthCheckData = new Dictionary();
+#if false
+ using (var appDb = new UserIdentityDbContext())
+ {
+ List recordList = new List();
+ try
+ {
+ string sqlQuery = $"SELECT 'AspNetUsers' AS TableName, COUNT(*) AS Count FROM information_schema.tables WHERE table_schema = '{dbName}' AND table_name = 'AspNetUsers' LIMIT 1;";
+ var table = await Task.FromResult(appDb.DbSetCounts.FromSqlRaw(sqlQuery).ToList());
+
+ // provo a controllare se ho tab utenti
+ if (table != null && table.Count > 0)
+ {
+ // controllo valore
+ if (table[0].Count > 0)
+ {
+ description = $"Check IdentityUsers table, found!";
+ return HealthCheckResult.Healthy(description, healthCheckData);
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error(exc, "Errore in esecuzione DbIdentity");
+ }
+ }
+#endif
+
+ return HealthCheckResult.Degraded(description + $" {dbName}", null, healthCheckData);
+ }
+
+ public static async Task DbPlantTable(string dbName)
+ {
+ string description = "Try check Table PlantLog";
+ var healthCheckData = new Dictionary();
+#if false
+ using (var appDb = new GWMSContext())
+ {
+ List recordList = new List();
+ try
+ {
+ // provo a controllare se ho tab utenti
+ recordList = await Task.FromResult(appDb.DbSetPlant.ToList()).ConfigureAwait(false);
+ if (recordList.Count > 0)
+ {
+ description = $"Check PlantDetail table, found {recordList.Count} records";
+ return HealthCheckResult.Healthy(description, healthCheckData);
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error(exc, "Errore in esecuzione PlantDetail Table");
+ }
+ }
+#endif
+ return HealthCheckResult.Degraded(description + $" {dbName}", null, healthCheckData);
+ }
+
+ public static async Task DbUserRoot(string dbName)
+ {
+ string description = "Try check MySql User table";
+ var healthCheckData = new Dictionary();
+#if false
+ using (var adminDb = new AdminContext())
+ {
+ List userList = new List();
+ try
+ {
+ // provo a controllare se ho tab utenti
+ userList = await Task.FromResult(adminDb.UserList.ToList()).ConfigureAwait(false);
+ if (userList.Count > 0)
+ {
+ description = $"Check MySql User table, found {userList.Count} records";
+ return HealthCheckResult.Healthy(description, healthCheckData);
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error(exc, "Errore in esecuzione DbUserRoot");
+ }
+ }
+#endif
+
+ return HealthCheckResult.Unhealthy(description + $" {dbName}", null, healthCheckData);
+ }
+
+ public static async Task PingCheck(string hostName)
+ {
+ var description = $"Ping to {hostName}";
+ var healthCheckData = new Dictionary();
+ using (var thePing = new Ping())
+ {
+ var pingResult = await thePing.SendPingAsync(hostName);
+ healthCheckData.Add("RoundTripMS", pingResult.RoundtripTime);
+ healthCheckData.Add("ActualIPAddress", pingResult.Address.ToString());
+ if (pingResult.Status == IPStatus.Success)
+ {
+ description += $" - {pingResult.RoundtripTime}ms";
+ return HealthCheckResult.Healthy(description, healthCheckData);
+ }
+
+ }
+ return HealthCheckResult.Unhealthy(description + $" {hostName}", null, healthCheckData);
+ }
+
+ #endregion Public Methods
+ }
+}
diff --git a/WebDoorCreator.UI/Program.cs b/WebDoorCreator.UI/Program.cs
index c0d8ab9..e57cfcb 100644
--- a/WebDoorCreator.UI/Program.cs
+++ b/WebDoorCreator.UI/Program.cs
@@ -1,25 +1,31 @@
using Blazored.LocalStorage;
using Blazored.SessionStorage;
+using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Web;
+using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.FileProviders;
using StackExchange.Redis;
+using System.Configuration;
using System.Globalization;
using System.Text.Json.Serialization;
using WebDoorCreator.Data;
using WebDoorCreator.Data.Services;
+using WebDoorCreator.UI;
using WebDoorCreator.UI.Areas.Identity;
using WebDoorCreator.UI.Data;
+using static Org.BouncyCastle.Math.EC.ECCurve;
var builder = WebApplication.CreateBuilder(args);
// configuration setup
-ConfigurationManager configuration = builder.Configuration;
+Microsoft.Extensions.Configuration.ConfigurationManager configuration = builder.Configuration;
// AspNetCore Identity setup
var connectionString = builder.Configuration.GetConnectionString("Identity.DB");
@@ -30,6 +36,49 @@ string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"))
// avvio oggetto shared x redis...
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
+string dbServerAddr = "127.0.0.1";
+if(connectionString.Contains("Server"))
+{
+ var dbTokens = connectionString.Split(";");
+ bool trovato = false;
+ int numTok = dbTokens.Count();
+ int idx = 0;
+ while(!trovato && idx< numTok)
+ {
+ if (dbTokens[idx].StartsWith("Server="))
+ {
+ dbServerAddr = dbTokens[idx].Replace("Server=", "");
+ trovato = true;
+ }
+ idx++;
+ }
+}
+// healthchecks
+builder.Services.AddHealthChecks()
+ //.AddSqlServer(connectionString, "MsSql instance")
+ .AddAsyncCheck($"DB PING ({dbServerAddr})", () => WebDoorCreator.UI.Health.Checks.PingCheck(dbServerAddr))
+ .AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => WebDoorCreator.UI.Health.Checks.PingCheck(redisSrvAddr))
+ //.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded) // 512 MB max allocated memory
+ .AddRedis(connStringRedis, "Redis", failureStatus: HealthStatus.Degraded)
+ //.AddAsyncCheck($"MsSql Root User", () => WebDoorCreator.UI.Health.Checks.DbUserRoot("MsSql"))
+ //.AddAsyncCheck($"MsSql Identity", () => WebDoorCreator.UI.Health.Checks.DbIdentity(DbConfig.DATABASE_NAME))
+ //.AddAsyncCheck($"MsSql PlantLog", () => WebDoorCreator.UI.Health.Checks.DbPlantTable(DbConfig.DATABASE_NAME))
+ ;
+
+builder.Services
+ .AddHealthChecksUI(s =>
+ {
+ s.AddHealthCheckEndpoint("GWMS_Services", "health");
+ s.SetEvaluationTimeInSeconds(60);
+ //s.SetEvaluationTimeInSeconds(60);
+ s.SetMinimumSecondsBetweenFailureNotifications(120);
+ s.SetApiMaxActiveRequests(5);
+ s.SetHeaderText("GWMS Health Check Status");
+ })
+ .AddInMemoryStorage();
+
+
+
// abilitazione x email management con MailKit
builder.Services.AddTransient();
builder.Services.Configure(options =>
@@ -126,6 +175,11 @@ app.UseAuthorization();
app.MapControllers();
app.MapBlazorHub();
+app.MapHealthChecks("/health", new HealthCheckOptions
+{
+ Predicate = _ => true,
+ ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
+});
app.MapFallbackToPage("/_Host");
app.Run();
diff --git a/WebDoorCreator.UI/WebDoorCreator.UI.csproj b/WebDoorCreator.UI/WebDoorCreator.UI.csproj
index 71a359e..8153591 100644
--- a/WebDoorCreator.UI/WebDoorCreator.UI.csproj
+++ b/WebDoorCreator.UI/WebDoorCreator.UI.csproj
@@ -3,7 +3,7 @@
net6.0
enable
- 0.9.2404.2311
+ 0.9.2404.2315
enable
aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608
@@ -37,6 +37,13 @@
+
+
+
+
+
+
+
@@ -50,6 +57,8 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
+