diff --git a/MP.INVE/Program.cs b/MP.INVE/Program.cs index e6c81e3f..13551e05 100644 --- a/MP.INVE/Program.cs +++ b/MP.INVE/Program.cs @@ -13,7 +13,7 @@ using StackExchange.Redis; var builder = WebApplication.CreateBuilder(args); /*-------------------- - * Note migrazione startup.cs -_> program.cs: + * Note migrazione startup.cs --> program.cs: * * - https://stackoverflow.com/questions/69722872/asp-net-core-6-how-to-access-configuration-during-startup * - https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60?view=aspnetcore-5.0&tabs=visual-studio#where-do-i-put-state-that-was-stored-as-fields-in-my-program-or-startup-class diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 069f1bc2..fcc5906d 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2410.1816 + 6.16.2410.2917 1800a78a-6ff1-40f9-b490-87fb8bfc1394 diff --git a/MP.SPEC/Program.cs b/MP.SPEC/Program.cs index b03f99b4..321a060f 100644 --- a/MP.SPEC/Program.cs +++ b/MP.SPEC/Program.cs @@ -3,6 +3,8 @@ using Blazored.SessionStorage; using Microsoft.AspNetCore.Authentication.Negotiate; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.StaticFiles; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.FileProviders; using MP.SPEC.Components; using MP.SPEC.Data; @@ -31,7 +33,7 @@ ConfigurationManager configuration = builder.Configuration; // REDIS setup -logger.Info("Setup REDIS"); +logger.Info("Setup REDIS"); string connStringRedis = configuration.GetConnectionString("Redis"); //string connStringRedis = ConfMan.GetConnectionString("RedisAdmin"); string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":")); @@ -40,7 +42,7 @@ var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis); // Add services to the container. -logger.Info("Setup Auth"); +logger.Info("Setup Auth"); builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme) .AddNegotiate(); @@ -66,6 +68,10 @@ logger.Info("Aggiunti services"); var app = builder.Build(); logger.Info("Build App"); + +// aggiunt base URL x routing corretto +app.UsePathBase(configuration.GetValue("SpecialConf:AppUrl")); + // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { @@ -82,12 +88,37 @@ app.UseStaticFiles(); string BasePathOdlReturn = configuration.GetValue("ServerConf:BasePathOdlReturn") ?? configuration.GetValue("OptConf:BasePathOdlReturn") ?? ""; if (!string.IsNullOrEmpty(BasePathOdlReturn)) { + // preparo mappings opzionali se presenti in conf... + var provider = new FileExtensionContentTypeProvider(); + // vedere https://code-maze.com/dotnet-appsettings-json-content-to-dictionary/ + var mimeSection = configuration.GetSection("ServerConf:MimeMappings"); + if (mimeSection != null) + { + var mimeDict = mimeSection + .AsEnumerable() + .Where(x => !string.IsNullOrWhiteSpace(x.Value)) + .ToDictionary(x => x.Key.Replace("ServerConf:MimeMappings:", ""), x => x.Value); + // se ne ho trovati + if (mimeDict != null && mimeDict.Count > 0) + { + // li aggiungo! vedere + // https://thechrisgreen.com/2022/05/add-a-mime-type-to-an-asp-net-core-net-6-app/ + // https://harrybellamy.com/posts/getting-mime-types-from-file-extensions-in-net-core/ + foreach (var item in mimeDict) + { + // Add new mappings + provider.Mappings[item.Key] = item.Value; + } + + } + } // verifico esista folder if (Directory.Exists(BasePathOdlReturn)) { // gestione cartella x file ritornati x ODL app.UseStaticFiles(new StaticFileOptions { + ContentTypeProvider = provider, FileProvider = new PhysicalFileProvider(BasePathOdlReturn), RequestPath = "/RET_DATA", }); diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 580cb4d1..f6f97c3c 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2410.1816

+

Versione: 6.16.2410.2917


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index b8981208..53d4963c 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.1816 +6.16.2410.2917 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index d4bc4d53..093a98fd 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.1816 + 6.16.2410.2917 https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html false diff --git a/MP.SPEC/appsettings.Production.json b/MP.SPEC/appsettings.Production.json index 3fda7d5b..e9feccf7 100644 --- a/MP.SPEC/appsettings.Production.json +++ b/MP.SPEC/appsettings.Production.json @@ -8,7 +8,6 @@ } }, "AllowedHosts": "*", - "CodApp": "MP.SPEC", "ConnectionStrings": { "MP.Data": "Server=localhost\\SQLEXPRESS;Database=MoonPro; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;", "Redis": "localhost:6379,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false", @@ -21,6 +20,13 @@ "redisLongTimeCache": 15, "MpIoBaseUrl": "http://localhost/MP/IO/", "MpIoNS": "MoonPro:SQL2016DEV:MoonPro", - "BasePathOdlReturn": "\\\\iis01\\W$\\Files\\ODL" + "BasePathOdlReturn": "\\\\iis01\\W$\\Files\\ODL", + "MimeMappings": { + ".dxf": "application/octet-stream", + ".utcfg": "application/octet-stream", + ".utdata": "application/octet-stream", + ".utprobe": "application/octet-stream", + ".utwedge": "application/octet-stream" + } } } diff --git a/MP.SPEC/appsettings.json b/MP.SPEC/appsettings.json index ca53c247..b454358a 100644 --- a/MP.SPEC/appsettings.json +++ b/MP.SPEC/appsettings.json @@ -49,7 +49,6 @@ ] }, "AllowedHosts": "*", - "CodApp": "MP.SPEC", "ConnectionStrings": { "MP.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;", "MP.Inve": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;", @@ -63,6 +62,18 @@ "redisLongTimeCache": "15", "MpIoBaseUrl": "http://localhost:20967/", "MpIoNS": "MoonPro:SQL2016DEV:MoonPro", - "BasePathOdlReturn": "\\\\iis01\\W$\\Files\\ODL" + "BasePathOdlReturn": "\\\\iis01\\W$\\Files\\ODL", + "MimeMappings": { + ".dxf": "application/octet-stream", + ".utcfg": "application/octet-stream", + ".utdata": "application/octet-stream", + ".utprobe": "application/octet-stream", + ".utwedge": "application/octet-stream" + } + }, + "SpecialConf": { + "AppUrl": "/MP/SPEC", + "CodApp": "MP-SPEC", + "CodModulo": "MP-SPEC" } } diff --git a/MP.TaskMan/Services/TaskService.cs b/MP.TaskMan/Services/TaskService.cs index ca9d42e9..a6d6d2d2 100644 --- a/MP.TaskMan/Services/TaskService.cs +++ b/MP.TaskMan/Services/TaskService.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Options; using MP.TaskMan.Controllers; using MP.TaskMan.Models; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using NLog; using StackExchange.Redis; using System; @@ -128,13 +129,15 @@ namespace MP.TaskMan.Services { var callResp = await RCallService.CallRestGet(TaskRec.Command, TaskRec.Args); DateTime dtEnd = DateTime.Now; + string formattedJson = JValue.Parse(callResp.Content).ToString(Formatting.Indented); TaskExecModel tExeMod = new TaskExecModel() { DtEnd = dtEnd, DtStart = dtStart, IsError = callResp.StatusCode != System.Net.HttpStatusCode.OK, TaskId = TaskRec.TaskId, - Result = $"{callResp.Content}".Replace("\"", ""), + // deserializzazione come json indentato?!? + Result = formattedJson// $"{callResp.Content}".Replace("\"", ""), }; // salvo su DB answ = MLController.TaskExecSaveExecuted(TaskRec.TaskId, SchedNext, tExeMod);