Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public class Program
  2. {
  3. public static void Main(string[] args)
  4. {
  5. var configuration = new ConfigurationBuilder()
  6. .SetBasePath(Directory.GetCurrentDirectory())
  7. .AddJsonFile("appsettings.json")
  8. .AddEnvironmentVariables()
  9. .Build();
  10. Log.Logger = new LoggerConfiguration()
  11. .ReadFrom.Configuration(configuration)
  12. .Enrich.FromLogContext()
  13. .CreateLogger();
  14.  
  15. try
  16. {
  17. Log.Information("Starting");
  18. CreateWebHostBuilder(args).Build().Run();
  19. }
  20. catch (Exception ex)
  21. {
  22. Log.Fatal(ex, "Host terminated unexpectedly");
  23. }
  24. finally
  25. {
  26. Log.CloseAndFlush();
  27. }
  28. }
  29.  
  30. public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
  31. WebHost.CreateDefaultBuilder(args)
  32. .UseSerilog()
  33. .UseStartup<Startup>();
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement