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.
46 lines
1.3 KiB
46 lines
1.3 KiB
namespace Lion.AbpPro;
|
|
|
|
public class Program
|
|
{
|
|
public static async Task<int> Main(string[] args)
|
|
{
|
|
Log.Logger = new LoggerConfiguration()
|
|
.WriteTo.Async(c => c.File("Logs/logs.txt"))
|
|
.WriteTo.Async(c => c.Console())
|
|
.CreateBootstrapLogger();
|
|
|
|
try
|
|
{
|
|
Log.Information("Lion.AbpPro.HttpApi.Host.");
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
builder.Host
|
|
.AddAppSettingsSecretsJson()
|
|
.UseAutofac()
|
|
.UseSerilog((context, loggerConfiguration) =>
|
|
{
|
|
SerilogToEsExtensions.SetSerilogConfiguration(
|
|
loggerConfiguration,
|
|
context.Configuration);
|
|
});
|
|
await builder.AddApplicationAsync<AbpProHttpApiHostModule>();
|
|
var app = builder.Build();
|
|
await app.InitializeApplicationAsync();
|
|
await app.RunAsync();
|
|
return 0;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (ex is HostAbortedException)
|
|
{
|
|
throw;
|
|
}
|
|
|
|
Log.Fatal(ex, "Host terminated unexpectedly!");
|
|
return 1;
|
|
}
|
|
finally
|
|
{
|
|
await Log.CloseAndFlushAsync();
|
|
}
|
|
}
|
|
}
|