0

I've written a C# HttpHandler in VS2010 and want to do some initialisation in the application_start() event (e.g. set up logging etc.), but for some reason it isn't firing.

I've tried running against the local VS server using auto-assign port and the event fires, but against IIS the event never hits. The ProcessRequest() is firing so its hitting the code, but when I run the solution, even after restarting IIS, application_start doesn't fire. I've read that VS cannot hook into the application_start event but I've done it before so do not believe that to be true. The application pool is runing in .net integrated mode and I've set my start URL to ensure that the handler is getting fired, which is is as I'm hitting ProcessRequest().

Is there any reason why it wouldn't fire?

Thanks

Edit. Looks like none of my events in Global.asax are firing. Is there any reason this might happen and how do i 'wire it up'?

LDJ
  • 6,896
  • 9
  • 52
  • 87

1 Answers1

0

1.Did you write Global.asax this way?

using System;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
public class Global : HttpApplication 
{
 protected void Application_Start(Object sender, EventArgs e) 
 {
   //some code
 }
}

2.Have you tried modifying web.config (i.e. insert a blank row)? Any config change will cause an Application restart, so the event fires.

Emanuele Greco
  • 12,551
  • 7
  • 51
  • 70
  • Yes, I just did a standard Global.asax. Even tried deleting and adding a new, blank one and adding a debug.write in app start, but it doesn't fire. Done a complete IIS restart and machine restart to no avail. – LDJ Mar 16 '12 at 08:33