Update conf start HealthCheck serv
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>WebDoorCreator - Egalware</i>
|
||||
<h4>Version: 0.9.2405.0913</h4>
|
||||
<h4>Version: 0.9.2405.0916</h4>
|
||||
<br /> Release note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.9.2405.0913
|
||||
0.9.2405.0916
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>0.9.2405.0913</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.API.zip</url>
|
||||
<version>0.9.2405.0916</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
|
||||
@@ -2,6 +2,7 @@ using HealthChecks.UI.Client;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.CodeAnalysis.FlowAnalysis;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using StackExchange.Redis;
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
@@ -35,29 +36,37 @@ builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
// APP MAIN setup
|
||||
string connectionString = configuration.GetConnectionString("WDC.DB")??"";
|
||||
string connectionString = configuration.GetConnectionString("WDC.DB") ?? "";
|
||||
string dbServerAddr = "127.0.0.1";
|
||||
if (connectionString != null && connectionString.Contains("Server"))
|
||||
|
||||
if (string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
bool trovato = false;
|
||||
var dbTokens = connectionString.Split(";");
|
||||
int numTok = dbTokens.Count();
|
||||
int idx = 0;
|
||||
while (!trovato && idx < numTok)
|
||||
connectionString = "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.SRV;";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (connectionString.Contains("Server"))
|
||||
{
|
||||
if (dbTokens[idx].StartsWith("Server="))
|
||||
bool trovato = false;
|
||||
var dbTokens = connectionString.Split(";");
|
||||
int numTok = dbTokens.Count();
|
||||
int idx = 0;
|
||||
while (!trovato && idx < numTok)
|
||||
{
|
||||
// rimuovo la chaive Server...
|
||||
dbServerAddr = dbTokens[idx].Replace("Server=", "");
|
||||
// se ci fosse un nome (tipo \\sqlexpress) rimuovo...
|
||||
if (dbServerAddr.Contains("\\"))
|
||||
if (dbTokens[idx].StartsWith("Server="))
|
||||
{
|
||||
int sIdx = dbServerAddr.IndexOf("\\");
|
||||
dbServerAddr = dbServerAddr.Substring(0, sIdx);
|
||||
// rimuovo la chaive Server...
|
||||
dbServerAddr = dbTokens[idx].Replace("Server=", "");
|
||||
// se ci fosse un nome (tipo \\sqlexpress) rimuovo...
|
||||
if (dbServerAddr.Contains("\\"))
|
||||
{
|
||||
int sIdx = dbServerAddr.IndexOf("\\");
|
||||
dbServerAddr = dbServerAddr.Substring(0, sIdx);
|
||||
}
|
||||
trovato = true;
|
||||
}
|
||||
trovato = true;
|
||||
idx++;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +86,8 @@ builder.Services.AddHealthChecks()
|
||||
builder.Services
|
||||
.AddHealthChecksUI(s =>
|
||||
{
|
||||
s.AddHealthCheckEndpoint("WDC.API_Services", "health");
|
||||
s.AddHealthCheckEndpoint("WDC_API_HC", "health");
|
||||
s.SetEvaluationTimeInSeconds(60);
|
||||
//s.SetEvaluationTimeInSeconds(60);
|
||||
s.SetMinimumSecondsBetweenFailureNotifications(120);
|
||||
s.SetApiMaxActiveRequests(5);
|
||||
s.SetHeaderText("WDC.API Health Check Status");
|
||||
@@ -130,30 +138,24 @@ if (app.Environment.IsDevelopment() || app.Environment.IsStaging())
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
|
||||
//// cultura IT...
|
||||
//var supportedCultures = new[]{
|
||||
// new CultureInfo("it-IT")
|
||||
// };
|
||||
//app.UseRequestLocalization(new RequestLocalizationOptions
|
||||
//{
|
||||
// DefaultRequestCulture = new RequestCulture("it-IT"),
|
||||
// SupportedCultures = supportedCultures,
|
||||
// FallBackToParentCultures = false
|
||||
//});
|
||||
//CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("it-IT");
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
// config healthcheck: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks
|
||||
// prende tutti i predicati
|
||||
app.MapHealthChecks("/health", new HealthCheckOptions
|
||||
{
|
||||
Predicate = _ => true,
|
||||
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
|
||||
});
|
||||
|
||||
// nasconde tutti i dettagli
|
||||
app.MapHealthChecks("/health/live", new HealthCheckOptions
|
||||
{
|
||||
Predicate = _ => false
|
||||
});
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"Redis": "localhost:26379,serviceName=devel, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false",
|
||||
"WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
|
||||
"WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.SRV;"
|
||||
},
|
||||
"ExternalProviders": {
|
||||
"MailKit": {
|
||||
|
||||
@@ -76,9 +76,8 @@ builder.Services.AddHealthChecks()
|
||||
builder.Services
|
||||
.AddHealthChecksUI(s =>
|
||||
{
|
||||
s.AddHealthCheckEndpoint("WDC.UI_Services", "health");
|
||||
s.AddHealthCheckEndpoint("WDC_UI_HC", "health");
|
||||
s.SetEvaluationTimeInSeconds(60);
|
||||
//s.SetEvaluationTimeInSeconds(60);
|
||||
s.SetMinimumSecondsBetweenFailureNotifications(120);
|
||||
s.SetApiMaxActiveRequests(5);
|
||||
s.SetHeaderText("WDC.UI Health Check Status");
|
||||
@@ -181,11 +180,21 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
app.MapBlazorHub();
|
||||
|
||||
// config healthcheck: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks
|
||||
// prende tutti i predicati
|
||||
app.MapHealthChecks("/health", new HealthCheckOptions
|
||||
{
|
||||
Predicate = _ => true,
|
||||
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
|
||||
});
|
||||
|
||||
// nasconde tutti i dettagli
|
||||
app.MapHealthChecks("/health/live", new HealthCheckOptions
|
||||
{
|
||||
Predicate = _ => false
|
||||
});
|
||||
|
||||
app.MapFallbackToPage("/_Host");
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.9.2405.0913</Version>
|
||||
<Version>0.9.2405.0916</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user