Update log x intercettare richieste IOC

This commit is contained in:
Samuele Locatelli
2026-04-04 10:07:17 +02:00
parent 566350bc28
commit bf2d937f48
4 changed files with 33 additions and 7 deletions
+30 -4
View File
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Http.Extensions;
using MP.IOC.Data;
using MP.IOC.Services;
using NLog;
@@ -86,14 +87,39 @@ var app = builder.Build();
// aggiunt base URL x routing corretto
string baseUrl = configuration.GetValue<string>("ServerConf:BaseUrl") ?? "";
app.UsePathBase(baseUrl);
string routePath = configuration.GetValue<string>("ServerConf:RoutePath") ?? "/api/RIOB";
string fullPath = $"{baseUrl}{routePath}".Replace("//", "/");
logger.Info($"BaseUrl: {baseUrl}");
// Map route to RouteManager
app.Map("/MP/IOC/api/RIOB/{**catchAll}", async (HttpContext ctx) =>
app.Use(async (ctx, next) =>
{
var routeManager = ctx.RequestServices.GetRequiredService<RouteManager>();
await routeManager.HandleAsync(ctx);
logger.Debug($"Incoming request PathBase='{ctx.Request.PathBase}' Path='{ctx.Request.Path}' RawTarget='{ctx.Request.GetEncodedUrl()}'");
await next();
});
// Map route to RouteManager
//app.Map("/MP/IOC/api/RIOB/{**catchAll}", async (HttpContext ctx) =>
//{
// var routeManager = ctx.RequestServices.GetRequiredService<RouteManager>();
// await routeManager.HandleAsync(ctx);
//});
// parametrizzare?!?!?
app.MapWhen(ctx =>
ctx.Request.Path.StartsWithSegments(fullPath, StringComparison.OrdinalIgnoreCase) ||
ctx.Request.Path.StartsWithSegments(routePath, StringComparison.OrdinalIgnoreCase) ||
(ctx.Request.PathBase.HasValue && ctx.Request.Path.StartsWithSegments(routePath, StringComparison.OrdinalIgnoreCase)),
builder =>
{
builder.Run(async ctx =>
{
var routeManager = ctx.RequestServices.GetRequiredService<RouteManager>();
await routeManager.HandleAsync(ctx);
});
});
logger.Info("App: route Mapped");
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 6.16.2604.409</h4>
<h4>Versione: 6.16.2604.410</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2604.409
6.16.2604.410
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2604.409</version>
<version>6.16.2604.410</version>
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>