title: Better way to post to an external api at a specific time everyday in Asp.Net Core C#
body: <p>I have a requirement where the Asp.Net Core Application(Deployed to IIS) needs to send data external domain("<a href="http://example.com/api/statistics" rel="nofollow noreferrer">http://example.com/api/statistics</a>") at a given time everyday(only once a day; say 6PM localTime where application is running). I am hesitant to place code any place(like in Startup.cs or Program.cs) that might create problems later. Something like the following : Your insights highly appreciated. Thank you.</p>
  
  <pre><code>        Task.Run(() =&gt;
          {
              while (true)
              {
  
                  using (var client = new HttpClient())
                  {
  
                      var response =  client.PostAsync("http://example.com/api/statistics",
                          new StringContent(JsonConvert.SerializeObject("data"), 
                          Encoding.UTF8, "application/json"));
                  }
              }
  
          });
  </code></pre>