views:

745

answers:

4

I have an ASP.NET 3.5 sp1 app that's in development in Cassini. The app includes a global.asax file that should run some code - it works fine in Cassini but in IIS the debugger never hits the function. Why doesn't that code run?

+1  A: 

You're manually attaching the debugger to the w3wp.exe process? Most likely you're simply too late and the Application_Start already ran by the time the debugger attaches.

Michael Stum
I'm hitting F5 in Visual Studio to get the attach. I've seen this work in other projects so it's not a "too late" issue.
James Cadd
+1  A: 

Are you sure that the code isn't being executed or could it be that you are simply attaching to the process too late for the debugger to be of any use for it? I'd suggest adding some logging to the method to be sure.

tvanfosson
+1  A: 

Maybe in Cassini, the Application is started when Cassini is launched. In II7, a service, the application is already started and when you launchh the debugger, VS attached only the debugger. You can try to launch the debugger and recycle the pool in the IIS console to see the application restarted ?

Matthieu
A: 

I'm seeing the same issue with a WCF web project running in IIS7. The very first line of code in Application_Start() is a logger write, and I never get it. Also, other objects that are supposed to be initialized on Application_Start never get created and the rest of my code fails because of it. Anyone ever figure anything out with this? It does run fine in Cassini...

rally25rs
Try this grue - in your global.asax.cs file define a private variable at the class level and new it up in the constructor. Hanging on to some state seems to fix it occasionally.
James Cadd