title: Can I run infinite loop in the background in ASP.NET CORE IIS
body: <p>At the end of the startup.cs I have a loop that runs every second infinitely. the loop just updates the DB every second. the server is deployed on windows IIS (AWS EC2).</p>
  <p>I want to know, after the first start of the server, will it run infinitely (every second) even without any traffic to the server? or will it stop after some time if the server has no traffic and starts again (run startup. cs again) when someone comes to the server? e.g, if we have no traffic in 1 month, will it running in the background for one month or stop?</p>
  <p><strong>Update</strong>
  Turns our loop will be removed after 5 - 10 minutes. is there any way I can achive this (run the loop for month without any traffic)?</p>
  <p><strong>Update 2</strong>
  The timeout is a setting in AWS EC2 <a href="https://aws.amazon.com/blogs/aws/elb-idle-timeout-control" rel="nofollow noreferrer">https://aws.amazon.com/blogs/aws/elb-idle-timeout-control</a> (which I did not have access to) appreciate any suggessions.</p>
  <p><strong>Update 3</strong>
  I was able to resolve this by separating timer logic into a console app and run inside ec2.</p>