12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.Extensions.Configuration;
- using Microsoft.Extensions.Hosting;
- using Microsoft.Extensions.Logging;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http;
- using System.Threading.Tasks;
-
- namespace Logger.API
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- try
- {
- CreateHostBuilder(args).Build().Run();
-
- //string URL = "api/weatherforecast/helloworld";
- //HttpClient client = new HttpClient();
- //client.BaseAddress = new Uri("http://localhost:40166/");
-
- //int rng = new Random().Next();
- //int n = 2;
- //for (int i = 1; i <= n; i++)
- //{
- // Task task = new Task(() => CallService(URL, client, i, rng));
- // task.Start();
- //}
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
-
- }
-
- //private static void CallService(string URL, HttpClient client, int id, int random)
- //{
- // for (int i = 1; i < 100; i++)
- // {
- // client.GetAsync(URL + "/" + id + "/" + random);
- // }
- //}
-
- public static IHostBuilder CreateHostBuilder(string[] args) =>
- Host.CreateDefaultBuilder(args)
- .ConfigureWebHostDefaults(webBuilder =>
- {
- webBuilder.UseStartup<Startup>();
- });
- }
- }
|