tags:

views:

1101

answers:

5

I've been developing an ASP .NET 3.5 web application against Cassini, the built-in web development server, rather than against IIS.

In my Global.asax file, in the Application_Start event handler, I have some code which logs the fact that the website has started up. This all works fine with Cassini.

Since deploying the site to a virtual directory on a test server using IIS6, I am finding there are no log entries being written, and so I'm concluding that the Application_Start handler is not firing.

I then tried removing the virtual directory and running the site directly out of the root of the website on the test server, but it didn't make any difference - still no log entry for application start.

I know these events should fire irrespective of my deployment environment, has anyone got any ideas what is going wrong here?

+2  A: 

How are you logging? Is it possible that your logging component is not correctly set up? For a quick test try throwing an exception inside Application_Start and that will tell you quickly whether or not the event is being raised.

Andrew Hare
Agreed... give this a try. Application_Start will be firing for sure ;)
womp
As Andrew says: you're operating from a false assumption. A better way to test would be for your Application_Start to set a global variable that is displayed by your Default.aspx. See what the page displays.
John Saunders
@John - I guess your suggestion is a little less drastic than mine :)
Andrew Hare
@Andrew: I decided to tone mine down. I was going to suggest rebooting the system, but decided that might not be permitted in a partial trust environment.
John Saunders
@John - Good thinking ;)
Andrew Hare
+1  A: 

If you make a request to your app does the "Application_Start" fire then? I don't believe it will be started until the first request is made.

David
Thanks David, you were spot on with this. I incorrectly assumed that Application_Start fired immediately after (for instance) editing web.config or resetting IIS. But it is delayed until the first request.
gilles27
A: 

In your deployed enviroment, what is the thing you're calling? The reason I ask is because if you're calling a WCF based web service (ending in .svc), then Applicaiton_Start will not fire as the call to WCF isn't going through the ASP.NET pipeline. This wouldn't necessarily rear it's head w/ Cassini.

James Alexander
+1  A: 

When you develop in Cassini you are running the application under the user's account- probably administrator. Once you've deployed to IIS, you are (hopefully) running under a lower privilidge account.

This lack of appropriate permissions is probably the reason why your application is not working correctly- I would check the security settings to write to the log (presumably you are writing to a log file?).

RichardOD
A: 

You may be getting a runtime exception that is occurring before your .NET code even gets a chance to run. If you look under the Event Viewer's Application logs, you may see some warnings or errors that will clue you in to what is happening.

Jacob