Help debugging - when does the Application_Start run in global.asax file?

混江龙づ霸主 提交于 2019-12-12 09:48:49

问题


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?


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/1567726/help-debugging-when-does-the-application-start-run-in-global-asax-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!