|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using Dapper;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Serialization;
- using Serilog;
- using TelpoDataService.Util.Clients;
- using TelpoPush.Position.Worker;
-
-
- #region ��־
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var configuration = new ConfigurationBuilder()
- .SetBasePath(Directory.GetCurrentDirectory())
- .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
- .Build();
-
- Log.Logger = new LoggerConfiguration()
- .ReadFrom.Configuration(configuration)
- .Enrich.WithThreadId()
- .CreateLogger();
- #endregion
- try
- {
- Log.Information("Starting up");
- var builder = Host.CreateApplicationBuilder(args);
-
- var config = builder.Configuration;
-
-
-
-
- JsonSerializerSettings setting = new JsonSerializerSettings();
- JsonConvert.DefaultSettings = () =>
- {
- setting.DateFormatString = "yyyy-MM-dd HH:mm:ss";
- setting.ContractResolver = new CamelCasePropertyNamesContractResolver();
- return setting;
- };
- builder.Services.AddTelpoDataServices(opt =>
- {
- opt.TelpoDataUrl = config["ServiceConfig:TelpoDataUrl"];
- });
-
- builder.Services.AddSerilog();
- builder.Services.AddHttpClient();
-
-
-
-
-
-
-
-
- builder.Services.AddHostedService<Worker>();
- var host = builder.Build();
- host.Run();
- }
- catch (Exception ex)
- {
- Log.Fatal(ex, "Application start-up failed");
- }
- finally
- {
- Log.CloseAndFlush();
- }
|