服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2025-04-09 f8b74ce69663bed763f9fbc5b251a5d2da9bb4c7
Tiger.Api/Program.cs
@@ -17,7 +17,7 @@
using Autofac;
using Tiger.IBusiness;
var begin = DateTime.Now;
try
{
   //非UI线程未捕获异常处理事件
@@ -47,11 +47,13 @@
   ConsoleExt.Write($"Link Start{(IsRunAsAdmin ? $" As Admin" : "")}", ConsoleColor.Cyan);
   ConsoleExt.WriteLine($"  < <-<--<---<----< ==== < ===== < ====== ", ConsoleColor.DarkCyan);
   Logger.Console.Info($"Begin to load {prod}");
   var options = new WebApplicationOptions
    System.Net.ServicePointManager.DefaultConnectionLimit = 1024;
    var options = new WebApplicationOptions
   {
       Args = args,
       ContentRootPath = pathToContentRoot
       ContentRootPath = pathToContentRoot,
   };
    var builder = WebApplication.CreateBuilder(options);
@@ -68,6 +70,7 @@
       });
       //builder.RegisterType<TestService>().As<ITest>();
   });
    Logger.Console.Info($"AutoFac container inject successful");
    var startup = new Startup(builder.Configuration);
   startup.ConfigureServices(builder.Services);
@@ -78,8 +81,12 @@
   
   builder.WebHost.UseKestrel(opt =>
   {
       opt.Limits.MinRequestBodyDataRate = null;
   });
        // 设置最大连接数
        opt.Limits.MaxConcurrentConnections = null;
        // 设置请求队列的长度
        opt.Limits.MaxConcurrentUpgradedConnections = null;
        opt.Limits.MinRequestBodyDataRate = null;
    });
    if (isService)
   {
@@ -95,7 +102,8 @@
    // Call Configure(), passing in the dependencies
    startup.Configure(app, app.Environment);
   Logger.Console.Info($"Run {prod} Successful");
    Logger.Console.Info($"Total Elapsed Time: {(DateTime.Now - begin).TotalSeconds:0.000} seconds");
    app.Run();
   Logger.Console.Info($"{prod} Host is shut down");
}