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.4 KiB
46 lines
1.4 KiB
using EShopOnAbp.Shared.Hosting.AspNetCore;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Serilog;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EShopOnAbp.AdministrationService
|
|
{
|
|
public class Program
|
|
{
|
|
public static async Task<int> Main(string[] args)
|
|
{
|
|
var assemblyName = typeof(Program).Assembly.GetName().Name;
|
|
|
|
SerilogConfigurationHelper.Configure(assemblyName);
|
|
|
|
try
|
|
{
|
|
Log.Information($"Starting {assemblyName}.");
|
|
await CreateHostBuilder(args).Build().RunAsync();
|
|
return 0;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!");
|
|
return 1;
|
|
}
|
|
finally
|
|
{
|
|
Log.CloseAndFlush();
|
|
}
|
|
}
|
|
|
|
internal static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureAppConfiguration(build =>
|
|
{
|
|
build.AddJsonFile("appsettings.secrets.json", optional: true);
|
|
})
|
|
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); })
|
|
.UseAutofac()
|
|
.UseSerilog();
|
|
}
|
|
}
|
|
|