This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class PdfDownloadInterceptor | |
| { | |
| public static async Task HandleAsync(ResponseTransformContext context) | |
| { | |
| var proxyResponse = context.ProxyResponse; | |
| var httpContext = context.HttpContext; | |
| if (proxyResponse == null) | |
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var builder = WebApplication.CreateBuilder(args); | |
| // Configuração do YARP que preserva cookies e headers | |
| builder.Services.AddReverseProxy() | |
| .LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")) | |
| .AddTransforms(builderContext => | |
| { | |
| // Preserva todos os headers importantes | |
| builderContext.AddRequestTransform(async context => | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Configuration; | |
| using System.Data; | |
| using System.Data.SqlClient; | |
| using Dapper; | |
| namespace Infrastructure.Database | |
| { | |
| // ================================ | |
| // 1. Enum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Concurrent; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.Linq; | |
| using System.Management; | |
| public static class SystemInfoHelper | |
| { | |
| // Stores last CPU samples per PID (important if pool recycles) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Provides helper methods to retrieve runtime and assembly-related information | |
| /// about the currently executing application. | |
| /// </summary> | |
| /// <remarks> | |
| /// This class is designed to be framework-agnostic and can be safely used in | |
| /// desktop, service, and web applications. | |
| /// | |
| /// When running under IIS, the application entry assembly may not represent | |
| /// the web application itself (it may resolve to the IIS worker process instead). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class HeartbeatService : IDisposable | |
| { | |
| private readonly HeartbeatSettings _cfg; | |
| private Timer _timer; | |
| private bool _running; | |
| public HeartbeatService(HeartbeatSettings cfg) | |
| { | |
| _cfg = cfg; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <system.webServer> | |
| <security> | |
| <requestFiltering> | |
| <fileExtensions> | |
| <add fileExtension=".svc" allowed="true" /> | |
| </fileExtensions> | |
| </requestFiltering> | |
| </security> | |
| </system.webServer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Concurrent; | |
| using System.IO; | |
| using System.Text; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| /// <summary> | |
| /// Thread-safe logger for web APIs with buffered writing and daily rotation. | |
| /// The file is only opened during flush, allowing safe moves at the end of the day. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ui "default" { | |
| // Access only locally (recommended) | |
| listen_address = "127.0.0.1:12345" | |
| // For remote access: "0.0.0.0:12345" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class TimeSpanFormatter | |
| { | |
| public static string ToReadableString(TimeSpan ts) | |
| { | |
| var parts = new List<string>(); | |
| if (ts.Days > 0) | |
| parts.Add($"{ts.Days} day{(ts.Days > 1 ? "s" : "")}"); | |
| if (ts.Hours > 0) |
NewerOlder