M
miha.valencic
Hi!
A while ago, I noticed that there are usually two instances of
HttpApplication created within IIS (observed on WinXPPro). Why is that?
Especially, since Application_Start handler is called on only one
instance (the one that was created first).
Anyone has an idea?
How to test:
I created my own class, which extended HttpApplication. In
Application_Start/End handlers I added some logging code and observed
the situation. The code is below (sorry for the messy code. Can one
format it somehow?).
Regards,
Miha
using System;
using System.Web;
[assembly:log4net.Config.XmlConfigurator()]
public class MyHttpApp : HttpApplication {
private static readonly log4net.ILog log =
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public MyHttpApp() {
log.InfoFormat("MyHttpApp constructor called! - Hashcode = {0}",
this.GetHashCode());
}
protected void Application_Start(Object sender, EventArgs e)
{
log.InfoFormat("MyHttpApp->Application_Start called! - Hashcode =
{0}", this.GetHashCode());
}
protected void Application_End(Object sender, EventArgs e)
{
log.Info("Application ending...");
}
}
A while ago, I noticed that there are usually two instances of
HttpApplication created within IIS (observed on WinXPPro). Why is that?
Especially, since Application_Start handler is called on only one
instance (the one that was created first).
Anyone has an idea?
How to test:
I created my own class, which extended HttpApplication. In
Application_Start/End handlers I added some logging code and observed
the situation. The code is below (sorry for the messy code. Can one
format it somehow?).
Regards,
Miha
using System;
using System.Web;
[assembly:log4net.Config.XmlConfigurator()]
public class MyHttpApp : HttpApplication {
private static readonly log4net.ILog log =
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public MyHttpApp() {
log.InfoFormat("MyHttpApp constructor called! - Hashcode = {0}",
this.GetHashCode());
}
protected void Application_Start(Object sender, EventArgs e)
{
log.InfoFormat("MyHttpApp->Application_Start called! - Hashcode =
{0}", this.GetHashCode());
}
protected void Application_End(Object sender, EventArgs e)
{
log.Info("Application ending...");
}
}