0

We have a simple .net application running crystal reports in an Azure VM. We have some code that detects if the application has restarted, and this application is restarting often.

protected void Application_Start()
{
    if (!HttpContext.Current.IsDebuggingEnabled)
        SendgridService.SendAppRestartEmail();        
}

I suspect the application is going to sleep or something is triggering the restart, but cant work out what.

After doing a lot of searching I am posting here to see if anyone can help

Dale Fraser
  • 4,623
  • 7
  • 39
  • 76
  • 1
    I suspect your AppPool is going recycling. By default that happens after 20 minutes without requests. See articles [1](https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/recycling/periodicrestart/), [2](https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/recycling/), [3](https://stackoverflow.com/questions/19985710/iis-idle-timeout-vs-recycle), [4](https://hostadvice.com/how-to/how-to-configure-idle-time-out-settings-for-an-application-pool-iis-7/) – trailmax Feb 25 '20 at 23:20
  • this looks promising, will test anc come back to you, should post as an answer for acceptance if it works. – Dale Fraser Feb 25 '20 at 23:50
  • @DaleFraser It seems there is an issue with your code, you might need to stress test your application. If your application pool keep recycling, this maybe caused by your site utilize high usage on the server or bad code. – Mark Spencer Feb 26 '20 at 04:31
  • @trailmax this fixed it, its low usage thus keep sleeping. Please post as answer so I can accept. – Dale Fraser Feb 27 '20 at 00:47
  • @DaleFraser posted – trailmax Feb 27 '20 at 09:22

1 Answers1

1

Most likely the problem is that your AppPool is getting recycled because of the low usage. You'll need to adjust timeout settings. See the following articles:

trailmax
  • 34,305
  • 22
  • 140
  • 234