简体   繁体   中英

Why does Application_Start run in Cassini but not in IIS7?

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?

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 ?

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.

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.

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM