feat: Add Kestrel HTTP/2 configuration for macOS

This commit is contained in:
masoodafar-web
2025-12-06 22:24:28 +03:30
parent a0da7eb8e0
commit adcc776230

View File

@@ -8,12 +8,24 @@ using Microsoft.Extensions.Logging;
using Serilog.Core; using Serilog.Core;
using Serilog; using Serilog;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using CMSMicroservice.WebApi.Common.Behaviours; using CMSMicroservice.WebApi.Common.Behaviours;
using Hangfire; using Hangfire;
using Hangfire.SqlServer; using Hangfire.SqlServer;
using Microsoft.AspNetCore.Server.Kestrel.Core;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
builder.WebHost.ConfigureKestrel(options =>
{
// Setup a HTTP/2 endpoint without TLS.
options.ListenLocalhost(5000, o => o.Protocols =
HttpProtocols.Http2);
});
}
var levelSwitch = new LoggingLevelSwitch(); var levelSwitch = new LoggingLevelSwitch();
// Read Seq configuration from appsettings.json // Read Seq configuration from appsettings.json