Nenhuma descrição

Program.cs 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.Net.Http;
  9. using System.Threading.Tasks;
  10. namespace Logger.API
  11. {
  12. public class Program
  13. {
  14. public static void Main(string[] args)
  15. {
  16. try
  17. {
  18. CreateHostBuilder(args).Build().Run();
  19. //string URL = "api/weatherforecast/helloworld";
  20. //HttpClient client = new HttpClient();
  21. //client.BaseAddress = new Uri("http://localhost:40166/");
  22. //int rng = new Random().Next();
  23. //int n = 2;
  24. //for (int i = 1; i <= n; i++)
  25. //{
  26. // Task task = new Task(() => CallService(URL, client, i, rng));
  27. // task.Start();
  28. //}
  29. }
  30. catch (Exception ex)
  31. {
  32. throw new Exception(ex.Message);
  33. }
  34. }
  35. //private static void CallService(string URL, HttpClient client, int id, int random)
  36. //{
  37. // for (int i = 1; i < 100; i++)
  38. // {
  39. // client.GetAsync(URL + "/" + id + "/" + random);
  40. // }
  41. //}
  42. public static IHostBuilder CreateHostBuilder(string[] args) =>
  43. Host.CreateDefaultBuilder(args)
  44. .ConfigureWebHostDefaults(webBuilder =>
  45. {
  46. webBuilder.UseStartup<Startup>();
  47. });
  48. }
  49. }

Powered by TurnKey Linux.