3

Here's the snippet from my Global.asax:

<script runat="server">  
    void Application_Start(object sender, EventArgs e) {
        // log this call
        EventLogger.Log("ApplicationStart");
    }

    void Application_BeginRequest(object sender, EventArgs e) {
        // log what the user is doing
        UsageLogger.Log(UsageLogger.GetServerVariables());
    }
</script>

When I open the log, I see many ApplicationStart calls interspersed with usage calls. Why does my application seem to restart so much?

rick schott
  • 20,915
  • 5
  • 51
  • 80
Jeff Meatball Yang
  • 35,999
  • 26
  • 90
  • 121

2 Answers2

3

Application_Start fires once when the app starts up. Application_BeginRequest happens on every request.

This link helped in a simliar question here.

ASP.NET Case Study: Lost session variables and appdomain recycles

Community
  • 1
  • 1
rick schott
  • 20,915
  • 5
  • 51
  • 80
3

That depends on the IIS configuration. the default is 20 minutes. The application will automatically restart if no request during this time period.

Henry Gao
  • 4,750
  • 1
  • 20
  • 20