Program.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using Microsoft.AspNetCore.Hosting;
  2. using Microsoft.Extensions.Configuration;
  3. using Microsoft.Extensions.Hosting;
  4. using Microsoft.Extensions.Logging;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Threading.Tasks;
  9. namespace HyperCube
  10. {
  11. public class Program
  12. {
  13. public static void Main(string[] args)
  14. {
  15. Utils.AdvConsole.Initialize();
  16. System.AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
  17. CreateHostBuilder(args).Build().Run();
  18. }
  19. private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
  20. {
  21. Exception ex = (Exception)e.ExceptionObject;
  22. Utils.AdvConsole.WriteLine($"UNHANDLED EXCEPTION: {ex.GetType()}\r\n{ex.Message}\r\n{ex.StackTrace}");
  23. }
  24. public static IHostBuilder CreateHostBuilder(string[] args) =>
  25. Host.CreateDefaultBuilder(args)
  26. .ConfigureWebHostDefaults(webBuilder =>
  27. {
  28. webBuilder.UseStartup<Startup>().UseUrls("http://localhost:85/");
  29. });
  30. }
  31. }