帮助调试-Application_Start何时在global.asax文件中运行? [英] Help debugging - when does the Application_Start run in global.asax file?

查看:163
本文介绍了帮助调试-Application_Start何时在global.asax文件中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的Global.asax中的代码段:

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>

打开日志时,我看到许多ApplicationStart调用散布在用法调用中。为什么我的应用程序似乎重启太多了?

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在应用启动时触发一次。 Application_BeginRequest发生在每个请求上。

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案例研究:丢失的会话变量和应用程序域回收

这篇关于帮助调试-Application_Start何时在global.asax文件中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆