【问题标题】:Help debugging - when does the Application_Start run in global.asax file?帮助调试 - Application_Start 何时在 global.asax 文件中运行?
【发布时间】:2009-10-14 17:16:14
【问题描述】:

这是我 Global.asax 中的 sn-p:

<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>

当我打开日志时,我看到许多 ApplicationStart 调用穿插着使用调用。为什么我的应用程序似乎重启了这么多?

【问题讨论】:

    标签: c# asp.net debugging global-asax


    【解决方案1】:

    Application_Start 在应用启动时触发一次。 Application_BeginRequest 发生在每个请求上。

    这个link 帮助解决了一个类似的问题here

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

    【讨论】:

      【解决方案2】:

      这取决于 IIS 配置。默认值为 20 分钟。如果在此期间没有请求,应用程序将自动重新启动。

      【讨论】:

      • 你能给我指点这方面的一些文件吗?这将非常有帮助,谢谢。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-19
      相关资源
      最近更新 更多