2024-11-08 17:21:49 +08:00
|
|
|
|
using JiShe.CollectBus.Host;
|
|
|
|
|
|
using Serilog;
|
|
|
|
|
|
|
|
|
|
|
|
public class Program
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
|
{
|
2024-11-13 17:50:52 +08:00
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
|
|
|
|
.WriteTo.Console()
|
|
|
|
|
|
.CreateLogger();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CreateHostBuilder(args).Build().Run();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
Log.Fatal(ex, "Application terminated unexpectedly");
|
|
|
|
|
|
}
|
|
|
|
|
|
finally
|
|
|
|
|
|
{
|
|
|
|
|
|
Log.CloseAndFlush();
|
|
|
|
|
|
}
|
2024-11-08 17:21:49 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
|
|
|
|
Host.CreateDefaultBuilder(args)
|
|
|
|
|
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
|
|
|
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
|
|
|
|
{
|
|
|
|
|
|
webBuilder.ConfigureKestrel((context, options) => { options.Limits.MaxRequestBodySize = 1024 * 50; });
|
|
|
|
|
|
webBuilder.UseStartup<Startup>();
|
|
|
|
|
|
})
|
|
|
|
|
|
.UseSerilog((context, loggerConfiguration) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
loggerConfiguration.ReadFrom.Configuration(context.Configuration);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|