You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.4 KiB
82 lines
2.4 KiB
using System;
|
|
using System.IO;
|
|
using Magicodes.ExporterAndImporter.Excel.Utility.TemplateExport;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Serilog;
|
|
using Serilog.Events;
|
|
|
|
namespace Win.Sfs.SettleAccount
|
|
{
|
|
public class Program
|
|
{
|
|
public static int Main(string[] args)
|
|
{
|
|
// Log.Logger = new LoggerConfiguration()
|
|
//#if DEBUG
|
|
// .MinimumLevel.Debug()
|
|
//#else
|
|
// .MinimumLevel.Information()
|
|
//#endif
|
|
// .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
|
// .Enrich.FromLogContext()
|
|
// .WriteTo.Async(c => c.File("Logs/logs.txt"))
|
|
//#if DEBUG
|
|
// .WriteTo.Async(c => c.Console())
|
|
//#endif
|
|
// .CreateLogger();
|
|
|
|
|
|
|
|
var configuration = new ConfigurationBuilder()
|
|
//#if DEBUG
|
|
// .AddJsonFile("appsettings.Development.json")
|
|
//#else
|
|
// .AddJsonFile("appsettings.json")
|
|
//#endif
|
|
.Build();
|
|
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
.ReadFrom.Configuration(configuration)
|
|
.WriteTo.Async(c => c.Console())
|
|
.CreateLogger();
|
|
|
|
|
|
try
|
|
{
|
|
Log.Information("Starting web host.");
|
|
CreateHostBuilder(args).Build().Run();
|
|
return 0;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Fatal(ex, "Host terminated unexpectedly!");
|
|
return 1;
|
|
}
|
|
finally
|
|
{
|
|
Log.CloseAndFlush();
|
|
}
|
|
}
|
|
|
|
internal static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
{
|
|
webBuilder.ConfigureKestrel((context, options) =>
|
|
{
|
|
|
|
//设置应用服务器Kestrel请求体最大为50MB
|
|
options.Limits.MaxRequestBodySize = 5242880000;
|
|
options.Limits.MaxRequestBufferSize = 302768;
|
|
options.Limits.MaxRequestLineSize = 302768;
|
|
|
|
});
|
|
webBuilder.UseStartup<Startup>();
|
|
})
|
|
.UseAutofac()
|
|
.UseSerilog();
|
|
}
|
|
}
|
|
|