Exemplo n.º 1
0
        private static string InitializeApp(HttpApplication app)
        {
            DnnLog.MethodEntry();
            HttpRequest request  = app.Request;
            string      redirect = Null.NullString;

            DnnLog.Trace("Request " + request.Url.LocalPath);

            //Don't process some of the AppStart methods if we are installing
            if (!request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx") &&
                !request.Url.LocalPath.ToLower().EndsWith("upgradewizard.aspx") &&
                !request.Url.LocalPath.ToLower().EndsWith("install.aspx"))
            {
                //Check whether the current App Version is the same as the DB Version
                redirect = CheckVersion(app);
                if (string.IsNullOrEmpty(redirect))
                {
                    DnnLog.Info("Application Initializing");

                    //Cache Mapped Directory(s)
                    CacheMappedDirectory();
                    //Set globals
                    Globals.IISAppName             = request.ServerVariables["APPL_MD_PATH"];
                    Globals.OperatingSystemVersion = Environment.OSVersion.Version;
                    Globals.NETFrameworkVersion    = GetNETFrameworkVersion();
                    Globals.DatabaseEngineVersion  = GetDatabaseEngineVersion();
                    //Try and Upgrade to Current Framewok
                    Upgrade.TryUpgradeNETFramework();

                    //Start Scheduler
                    StartScheduler();
                    //Log Application Start
                    LogStart();
                    //Process any messages in the EventQueue for the Application_Start event
                    EventQueueController.ProcessMessages("Application_Start");

                    ServicesRoutingManager.RegisterServiceRoutes();

                    //Set Flag so we can determine the first Page Request after Application Start
                    app.Context.Items.Add("FirstRequest", true);

                    //Log Server information
                    ServerController.UpdateServerActivity(new ServerInfo());
                    DnnLog.Info("Application Initialized");
                }
            }
            else
            {
                //NET Framework version is neeed by Upgrade
                Globals.NETFrameworkVersion = GetNETFrameworkVersion();
            }
            return(redirect);
        }
Exemplo n.º 2
0
        private void Application_End(object Sender, EventArgs E)
        {
            DnnLog.MethodEntry();
            DnnLog.Info("Application Ending");
            Initialize.LogEnd();
            Initialize.StopScheduler();

            DnnLog.Trace("Dumping all Application Errors");
            if (HttpContext.Current != null)
            {
                foreach (Exception exc in HttpContext.Current.AllErrors)
                {
                    DnnLog.Fatal(exc);
                }
            }
            DnnLog.Trace("End Dumping all Application Errors");
            DnnLog.Info("Application Ended");
        }
Exemplo n.º 3
0
        private void Application_Start(object Sender, EventArgs E)
        {
            DnnLog.Info("Application Starting");

            if (String.IsNullOrEmpty(Config.GetSetting("ServerName")))
            {
                Globals.ServerName = Dns.GetHostName();
            }
            else
            {
                Globals.ServerName = Config.GetSetting("ServerName");
            }

            ComponentFactory.Container = new SimpleContainer();
            ComponentFactory.InstallComponents(new ProviderInstaller("data", typeof(DataProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("caching", typeof(CachingProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("logging", typeof(LoggingProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("scheduling", typeof(SchedulingProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("searchIndex", typeof(IndexingProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("searchDataStore", typeof(SearchDataStoreProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("friendlyUrl", typeof(FriendlyUrlProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("members", typeof(MembershipProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("roles", typeof(RoleProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("profiles", typeof(ProfileProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("permissions", typeof(PermissionProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("outputCaching", typeof(OutputCachingProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("moduleCaching", typeof(ModuleCachingProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("sitemap", typeof(SitemapProvider)));
            ComponentFactory.InstallComponents(new ProviderInstaller("folder", typeof(FolderProvider)));
            RegisterIfNotAlreadyRegistered <FolderProvider, StandardFolderProvider>("StandardFolderProvider");
            RegisterIfNotAlreadyRegistered <FolderProvider, SecureFolderProvider>("SecureFolderProvider");
            RegisterIfNotAlreadyRegistered <FolderProvider, DatabaseFolderProvider>("DatabaseFolderProvider");
            RegisterIfNotAlreadyRegistered <PermissionProvider>();
            ComponentFactory.InstallComponents(new ProviderInstaller("htmlEditor", typeof(HtmlEditorProvider), ComponentLifeStyleType.Transient));
            ComponentFactory.InstallComponents(new ProviderInstaller("navigationControl", typeof(NavigationProvider), ComponentLifeStyleType.Transient));
            ComponentFactory.InstallComponents(new ProviderInstaller("clientcapability", typeof(ClientCapabilityProvider)));

            DnnLog.Info("Application Started");
        }
Exemplo n.º 4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LogEnd logs the Application Start Event
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]    1/28/2005   Moved back to App_End from Logging Module
        /// </history>
        /// -----------------------------------------------------------------------------
        public static void LogEnd()
        {
            try
            {
                ApplicationShutdownReason shutdownReason = HostingEnvironment.ShutdownReason;
                string shutdownDetail = "";
                switch (shutdownReason)
                {
                case ApplicationShutdownReason.BinDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the Bin folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.BrowsersDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the App_Browsers folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.ChangeInGlobalAsax:
                    shutdownDetail = "The AppDomain shut down because of a change to Global.asax.";
                    break;

                case ApplicationShutdownReason.ChangeInSecurityPolicyFile:
                    shutdownDetail = "The AppDomain shut down because of a change in the code access security policy file.";
                    break;

                case ApplicationShutdownReason.CodeDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the App_Code folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.ConfigurationChange:
                    shutdownDetail = "The AppDomain shut down because of a change to the application level configuration.";
                    break;

                case ApplicationShutdownReason.HostingEnvironment:
                    shutdownDetail = "The AppDomain shut down because of the hosting environment.";
                    break;

                case ApplicationShutdownReason.HttpRuntimeClose:
                    shutdownDetail = "The AppDomain shut down because of a call to Close.";
                    break;

                case ApplicationShutdownReason.IdleTimeout:
                    shutdownDetail = "The AppDomain shut down because of the maximum allowed idle time limit.";
                    break;

                case ApplicationShutdownReason.InitializationError:
                    shutdownDetail = "The AppDomain shut down because of an AppDomain initialization error.";
                    break;

                case ApplicationShutdownReason.MaxRecompilationsReached:
                    shutdownDetail = "The AppDomain shut down because of the maximum number of dynamic recompiles of resources limit.";
                    break;

                case ApplicationShutdownReason.PhysicalApplicationPathChanged:
                    shutdownDetail = "The AppDomain shut down because of a change to the physical path for the application.";
                    break;

                case ApplicationShutdownReason.ResourcesDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the App_GlobalResources folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.UnloadAppDomainCalled:
                    shutdownDetail = "The AppDomain shut down because of a call to UnloadAppDomain.";
                    break;

                default:
                    shutdownDetail = "No shutdown reason provided.";
                    break;
                }
                var objEv           = new EventLogController();
                var objEventLogInfo = new LogInfo();
                objEventLogInfo.BypassBuffering = true;
                objEventLogInfo.LogTypeKey      = EventLogController.EventLogType.APPLICATION_SHUTTING_DOWN.ToString();
                objEventLogInfo.AddProperty("Shutdown Details", shutdownDetail);
                objEv.AddLog(objEventLogInfo);

                DnnLog.Info("Application shutting down. Reason: {0}", shutdownDetail);
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }
            if (Globals.Status != Globals.UpgradeStatus.Install)
            {
                //purge log buffer
                LoggingProvider.Instance().PurgeLogBuffer();
            }
        }
Exemplo n.º 5
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// The AddInfo method adds a new LogEntry of type Info to the Logs collection
 /// </summary>
 /// <param name="info">The description of the LogEntry</param>
 /// <history>
 ///     [cnurse]	07/24/2007  created
 /// </history>
 /// -----------------------------------------------------------------------------
 public void AddInfo(string info)
 {
     _logs.Add(new LogEntry(LogType.Info, info));
     DnnLog.Info(info);
 }