title: Hosted Service/Backgroundservice being stopped for .Net Core Hosted in Azure App Service
body: <p>Hi I am facing this problem for quite some days. Hope I can find some solution here.</p>
  <p>I am having a dotnet core application where I have implemented HostingService to pickup some records from database and push it to quartz trigger.</p>
  <p>Following works fine in IIS but when deployed to Azure HostingService is been run for few iterations and there's no logs after some time.</p>
  <p>I have been using  the sample from this <a href="https://devblogs.microsoft.com/cesardelatorre/implementing-background-tasks-in-microservices-with-ihostedservice-and-the-backgroundservice-class-net-core-2-x/" rel="nofollow noreferrer">link</a>.</p>
  <p>My Execute will look something like this</p>
  <pre><code>Execute:
  {
     for(;true;)
     {
        writelog()
        List data = getfromdb();
        foreach(var d in data )
        {
          if(checklogic)
          {
            pushtoquartz(d)
          }
        }
     }
  }
  </code></pre>
  <p>There's so many jobs I need to fire at same time like 10.00 AM Daily this can go upto 10,000+. Any suggestions on implementation, or any design flaw if any in current implementation, or any suggestions really appreciated.</p>
  <p>I have written another implementation for the same and this time I have used Hangfire to check for db records every 1 minute. This seems to have an issue too works well in IIS but not in Azure. Implementation is as follows</p>
  <pre><code>List data = getfromdb();
  writelog()
  foreach(var d in data )
  {
   if(checklogic)
    {
      pushtoquartz(d)
    }
  }
  </code></pre>
  <p>Have handled Exceptions.</p>
  <p>Thanks for reading through. First time on on stackoverflow, I can add more info if necessary that I missed.</p>
  <p>Environment:</p>
  <ul>
  <li>Dotnetcore   v3.1</li>
  <li>Azure App Service Linux B1-Tier</li>
  </ul>