2024-01-22 09:17:01 +08:00
|
|
|
|
using Microsoft.AspNetCore;
|
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
|
using Autofac.Extensions.DependencyInjection;
|
2024-03-20 17:35:08 +08:00
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
|
using Serilog;
|
2024-01-22 09:17:01 +08:00
|
|
|
|
|
|
|
|
|
|
namespace APT.RB.WebApi
|
|
|
|
|
|
{
|
|
|
|
|
|
public class Program
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
|
{
|
2024-03-20 17:35:08 +08:00
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
|
|
|
|
.MinimumLevel.Override("Microsoft", Serilog.Events.LogEventLevel.Error)
|
|
|
|
|
|
.WriteTo.File("logInfo/log-.txt", rollingInterval: RollingInterval.Month)
|
|
|
|
|
|
.CreateLogger();
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
CreateWebHostBuilder(args).Build().Run();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (System.Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
Log.Fatal(ex, "Host terminated unexpectedly");
|
|
|
|
|
|
}
|
|
|
|
|
|
finally
|
|
|
|
|
|
{
|
|
|
|
|
|
Log.CloseAndFlush();
|
|
|
|
|
|
}
|
2024-01-22 09:17:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
|
|
|
|
|
WebHost.CreateDefaultBuilder(args)
|
|
|
|
|
|
.ConfigureServices(services => services.AddAutofac())
|
2024-03-20 17:35:08 +08:00
|
|
|
|
.UseStartup<Startup>().UseSerilog();//wyw
|
2024-01-22 09:17:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|