You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On .NET Framework 4.0, methods registered with ApplicationShutdownMethodAttribute are not called when a web application is shutting down.
They work as expected when the host machine has .NET Framework 4.5.
Reason: WebActivator considers an application shutting down when a number of its special 'counter' modules (StartMethodCallingModule) goes down to 0.
This doesn't work properly on .NET 4.0 because of a bug in HttpApplicationFactory, which doesn't dispose a 'special' pool of HttpApplications.
(see http://connect.microsoft.com/VisualStudio/feedback/details/632507/httpmodules-attached-to-the-special-httpapplication-instance-are-not-disposed)
As a result, some copies of StartMethodCallingModule will remain undisposed, their counter won't go down to 0, and ApplicationShutdownMethodAttribute methods won't be called.
This HttpApplicationFactory bug seems to be fixed in .NET 4.5 ('special' HttpApplication pool is getting disposed).
The text was updated successfully, but these errors were encountered:
Ah, I didn't know that. Do you know if there is a way to fix it so it works in both 4.0 and 4.5? I don't think there is any HttpApplication event that can help here.
No, there doesn't seem to be any event that would be guaranteed to happen after ALL HttpApplications and HttpModules are disposed.
Application_End event is fired BEFORE HttpApplications/HttpModules from this 'special' pool are disposed (which doesn't make it good enough for uses like DI container disposal).
On .NET Framework 4.0, methods registered with ApplicationShutdownMethodAttribute are not called when a web application is shutting down.
They work as expected when the host machine has .NET Framework 4.5.
Reason: WebActivator considers an application shutting down when a number of its special 'counter' modules (StartMethodCallingModule) goes down to 0.
This doesn't work properly on .NET 4.0 because of a bug in HttpApplicationFactory, which doesn't dispose a 'special' pool of HttpApplications.
(see
http://connect.microsoft.com/VisualStudio/feedback/details/632507/httpmodules-attached-to-the-special-httpapplication-instance-are-not-disposed)
As a result, some copies of StartMethodCallingModule will remain undisposed, their counter won't go down to 0, and ApplicationShutdownMethodAttribute methods won't be called.
This HttpApplicationFactory bug seems to be fixed in .NET 4.5 ('special' HttpApplication pool is getting disposed).
The text was updated successfully, but these errors were encountered: