开发者

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

开发者 https://www.devze.com 2022-12-09 01:11 出处:网络
Here\'s the snippet from my Global.asax: <script runat=\"server\"> void Application_Start(object sender, EventArgs e) {

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 sen开发者_JS百科der, 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?


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消