Program.cs 984 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using Microsoft.AspNetCore;
  3. using Microsoft.AspNetCore.Hosting;
  4. namespace vCloud.Server.Videos
  5. {
  6. public class Program
  7. {
  8. public static void Main(string[] args)
  9. {
  10. try
  11. {
  12. if (args.Length > 0)
  13. {
  14. var port = args[1];
  15. BuildWebHost($"*:{port}").Run();
  16. }
  17. else
  18. {
  19. BuildWebHost("*:9107").Run();
  20. }
  21. }
  22. catch (Exception exception)
  23. {
  24. Console.WriteLine($"build web host failed, error: {exception.Message}");
  25. Console.ReadLine();
  26. }
  27. }
  28. private static IWebHost BuildWebHost(string serverUrl) =>
  29. WebHost.CreateDefaultBuilder()
  30. .UseKestrel()
  31. .UseUrls($"http://{serverUrl}")
  32. .UseStartup<Startup>()
  33. .Build();
  34. }
  35. }