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.
53 lines
1.5 KiB
53 lines
1.5 KiB
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Serilog;
|
|
|
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent;
|
|
|
|
public class Program
|
|
{
|
|
public static async Task<int> Main(string[] args)
|
|
{
|
|
IConfigurationRoot configuration =
|
|
new ConfigurationBuilder()
|
|
.AddJsonFile("serilogsettings.json", false, true)
|
|
.Build();
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
.ReadFrom.Configuration(configuration)
|
|
.CreateLogger();
|
|
|
|
try
|
|
{
|
|
Log.Information("Starting console host.");
|
|
await CreateHostBuilder(args).RunConsoleAsync().ConfigureAwait(false);
|
|
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)
|
|
.UseAutofac()
|
|
.UseSerilog()
|
|
.ConfigureAppConfiguration((context, config) =>
|
|
{
|
|
//setup your additional configuration sources
|
|
})
|
|
.ConfigureServices((hostContext, services) =>
|
|
{
|
|
services.AddApplication<InjectionMoldingTaskAgentModule>();
|
|
});
|
|
}
|
|
|