Carl Bergquist
Carl Bergquist

Reputation: 3942

Can an application "die" without passing Application_End or Application_Error?

The current application that I'm working on seems to recycle the application pool very often, but when it ends, id doesnt pass Application End or Application Start.
This is how my Global.asax looks like.

protected void Application_Start(object sender, EventArgs e)
{
    _log.Info("Application_Start");
}
    protected void Application_End(object sender, EventArgs e)
{
    _log.Info("Application_End");
}
    protected void Application_Error(object sender, EventArgs e)
{
    _log.Error("Application_Error");
    _log.Error(Server.GetLastError());
}

What can cause the application to "die" without passing End or Error?

Upvotes: 2

Views: 1290

Answers (1)

kemiller2002
kemiller2002

Reputation: 115528

Technically, it should fire with the app pool resets. Is it possible that something is disposing the _log object, or putting it in a state that is causing it to fail to log?

This isn't going to help in your case, but I am adding it, while I am trying to find an answer as it is somewhat relevant and something to watch out for:

http://forums.asp.net/p/948103/1152361.aspx#1152361

Try switching the Event to Application_OnEnd and see if that works. I saw another post talking about that. http://bytes.com/topic/asp-net/answers/326302-application_end-not-fired-when-app-unloaded-why

Upvotes: 3

Related Questions