views:

184

answers:

1

Hi,

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?

+1  A: 

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

Kevin
System.StackOverflowException was the bad guy in this case. Thanks for the help :) I cannot edit your post, so it would be nice if you added that piece of information to your post.
Carl Bergquist