Application_End never executes

  • Thread starter Thread starter Pedro Duque
  • Start date Start date
P

Pedro Duque

I've created a .net web service in c#.
When there is no open session i need to free some
resources.
So, I've place the code on the Global.Application_End
member.
Unffortunatly it seems that the code is never executed (at
least when i debug it).

Help anyone?
 
Hi Pedro,


The application does not ends when there are no sessions actives, if you
want to trigger the application_end to trigger you could stop the IIS admin
service while running the application, this will do the trick ;)


If you want to free resources when the session number reach 0 then I would
do something more simple, just keep a counter on the application scope that
is increased in the Session_Start and decrease on the Session_End if it
reach 0 do your cleaning , now that there is no session active does not
imply a new session will no be created soon, so you have to valorate if it's
better to have them active or just freed them.


Pd:
According to MSDN a change in the global.asax should have the same effect ,
I haven't try it but maybe you should as it's a less drastic solution that
stop the IIS service.

Hope this help,
 
Back
Top