Esempio n. 1
0
        protected virtual void Application_End()
        {
            ApplicationShutdownReason reason = HostingEnvironment.ShutdownReason;

            LogHelper.TraceIfEnabled <MvcApplication>("Shutting down due to: " + reason.ToString());
            LogHelper.TraceIfEnabled <MvcApplication>("Stack on shutdown: " + TryGetShutdownStack());
        }
        // Called by BuildManagerHost when the ASP appdomain is unloaded
        internal void OnAppDomainUnloaded(ApplicationShutdownReason reason)
        {
            Debug.Trace("CBM", "OnAppDomainUnloaded " + reason.ToString());

            _reason          = reason;
            _waitForCallBack = false;

            // Don't do anything that can be slow here.  Instead queue in a worker thread
            ThreadPool.QueueUserWorkItem(_onAppDomainUnloadedCallback);
        }
    // Called by BuildManagerHost when the ASP appdomain is unloaded
    internal void OnAppDomainUnloaded(ApplicationShutdownReason reason) {
        Debug.Trace("CBM", "OnAppDomainUnloaded " + reason.ToString());

        _reason = reason;
        _waitForCallBack = false;

        // Don't do anything that can be slow here.  Instead queue in a worker thread
        ThreadPool.QueueUserWorkItem(_onAppDomainUnloadedCallback);
    }
Esempio n. 4
0
        protected void Application_End(object sender, EventArgs e)
        {
            var runtime = (HttpRuntime)typeof(HttpRuntime).InvokeMember("_theRuntime", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null);

            if (runtime != null)
            {
                string shutDownMessage = (string)runtime.GetType().InvokeMember("_shutDownMessage", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null);
                string shutDownStack   = (string)runtime.GetType().InvokeMember("_shutDownStack", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null);
                ApplicationShutdownReason shutDownReason = (ApplicationShutdownReason)runtime.GetType().InvokeMember("_shutdownReason", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null);
                LogHelper.WriteCustom(string.Format("Application_End:shutDownMessage:\r\n{0}\r\nshutDownStack:\r\n{1}\r\nshutDownReason:\r\n{2}\r\n", shutDownMessage, shutDownStack, shutDownReason.ToString()), @"Application\", false);
            }
        }