// Token: 0x06000009 RID: 9 RVA: 0x0000215C File Offset: 0x0000035C
 public void OnStartBegin()
 {
     this.isStarted = true;
     Configuration.Initialize(this.eventLog, new Action(this.serviceManager.StopService));
     if (!Configuration.ServiceEnabled)
     {
         AddressBookService.GeneralTracer.TraceDebug(0L, "The service is not enabled.");
         return;
     }
     AddressBookService.InitializePerfCounters(new AddressBookPerformanceCounters());
     NspiPropMapper.Initialize();
     this.RegisterServicePrincipalNames();
     ADSession.DisableAdminTopologyMode();
     this.serviceManager.AddHttpPort(6001.ToString());
     NspiServer.Initialize(this.serviceManager, this.eventLog);
     RfriServer.Initialize(this.serviceManager, this.eventLog);
     if (Configuration.ProtocolLoggingEnabled)
     {
         if (string.IsNullOrEmpty(Configuration.LogFilePath))
         {
             this.eventLog.LogEvent(AddressBookEventLogConstants.Tuple_BadConfigParameter, "LogFilePath", new object[]
             {
                 Configuration.LogFilePath
             });
             return;
         }
         ProtocolLog.Initialize(ExDateTime.UtcNow, Configuration.LogFilePath, TimeSpan.FromHours((double)Configuration.MaxRetentionPeriod), Configuration.MaxDirectorySize, Configuration.PerFileMaxSize, Configuration.ApplyHourPrecision);
     }
 }
示例#2
0
        private void Application_Start(object sender, EventArgs e)
        {
            EcpEventLogConstants.Tuple_EcpStarted.LogEvent(new object[]
            {
                AppDomain.CurrentDomain.FriendlyName
            });
            if (!Util.IsDataCenter)
            {
                ServiceDiscovery.ADNotificationScope = ExchangeTopologyScope.ADAndExchangeServerAndSiteAndVirtualDirectoryTopology;
            }
            Globals.InitializeMultiPerfCounterInstance("ECP");
            foreach (ExPerformanceCounter exPerformanceCounter in EcpPerfCounters.AllCounters)
            {
                exPerformanceCounter.RawValue = 0L;
            }
            using (Process currentProcess = Process.GetCurrentProcess())
            {
                EcpPerfCounters.PID.RawValue = (long)currentProcess.Id;
            }
            ADSession.DisableAdminTopologyMode();
            BaseSprite.IsDataCenter      = Util.IsMicrosoftHostedOnly;
            BaseSprite.GetSpriteImageSrc = new GetSpriteImageSrcDelegate(Util.GetSpriteImageSrc);
            VirtualDirectoryConfiguration.EcpVirtualDirectoryAnonymousAuthenticationEnabled = VirtualDirectoryConfiguration.GetEcpAnonymousAuthenticationStatus();
            string identification = ConfigurationManager.AppSettings["ProvisioningCacheIdentification"];

            ProvisioningCache.InitializeAppRegistrySettings(identification);
            this.InvokeExtendedApplicationStart(sender, e);
            ScriptManager.ScriptResourceMapping.AddDefinition("MicrosoftAjax.js", new ScriptResourceDefinition
            {
                Path      = ThemeResource.ScriptPath + "microsoftajax.js",
                DebugPath = ThemeResource.ScriptPath + "microsoftajax.debug.js"
            });
        }
        // Token: 0x06000004 RID: 4 RVA: 0x0000223C File Offset: 0x0000043C
        protected override void OnStartInternal(string[] args)
        {
            if (AssistantsService.debugBreakOnStart)
            {
                Debugger.Break();
            }
            using (Process currentProcess = Process.GetCurrentProcess())
            {
                Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStarting, null, new object[]
                {
                    currentProcess.Id,
                    "Microsoft Exchange",
                    "15.00.1497.010"
                });
            }
            AssistantsService.TracerPfd.TracePfd <int, DateTime>((long)this.GetHashCode(), "PFD IWS {0} Starting the Mailbox Assistants Service {1} ", 28055, DateTime.UtcNow);
            AssistantsLog.LogServiceStartEvent(this.activityId);
            bool flag = false;

            try
            {
                ADSession.DisableAdminTopologyMode();
                SettingOverrideSync.Instance.Start(true);
                ProcessAccessManager.RegisterComponent(SettingOverrideSync.Instance);
                AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Initializing the Assistant Infrastructure", 27479);
                this.databaseManager = new DatabaseManager("MSExchangeMailboxAssistants", 50, InfoworkerAssistants.CreateEventBasedAssistantTypes(), InfoworkerAssistants.CreateTimeBasedAssistantTypes(), true);
                this.databaseManager.Start();
                MailboxSearchServer.StartServer();
                Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStarted, null, new object[0]);
                AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Mailbox Assistants Service is started successfully ", 23959);
                if (Configuration.MemoryMonitorEnabled)
                {
                    this.memoryMonitor = new MemoryMonitor();
                    this.memoryMonitor.Start((ulong)Configuration.MemoryBarrierPrivateBytesUsageLimit, (uint)Configuration.MemoryBarrierNumberOfSamples, Configuration.MemoryBarrierSamplingDelay, Configuration.MemoryBarrierSamplingInterval, delegate(ulong memoryInUse)
                    {
                        Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceOutOfMemory, null, new object[]
                        {
                            memoryInUse
                        });
                        throw new ServiceOutOfMemoryException();
                    });
                }
                this.watermarkCleanupTimer = new Timer(new TimerCallback(InfoworkerAssistants.DeleteWatermarksForDisabledAndDeprecatedAssistants), null, Configuration.WatermarkCleanupInterval, Configuration.WatermarkCleanupInterval);
                ProcessAccessManager.RegisterComponent(this);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceFailedToStart, null, new object[0]);
                }
            }
        }
示例#4
0
 static MRSService()
 {
     ServerThrottlingResource.InitializeServerThrottlingObjects(true);
     ResourceLoadDelayInfo.Initialize();
     ADSession.DisableAdminTopologyMode();
     MRSService.NextFullScanTime  = DateTime.MinValue;
     MRSService.scheduledLogsList = new List <ILogProcessable>();
     MRSService.jobPoller         = new PeriodicJobExecuter("PickHeavyJobs", new PeriodicJobExecuter.JobPollerCallback(MRSService.PickHeavyJobs), 0.1);
     MRSService.lightJobPoller    = new PeriodicJobExecuter("PickLightJobs", new PeriodicJobExecuter.JobPollerCallback(MRSService.PickLightJobs), 0.1);
     MRSService.logDumper         = new PeriodicJobExecuter("DumpLogFiles", new PeriodicJobExecuter.JobPollerCallback(MRSService.DumpLogFiles), 0.0);
     MRSService.issueCache        = new MRSIssueCache();
     MailboxReplicationServicePerformanceCounters.LastScanTime.RawValue = CommonUtils.TimestampToPerfcounterLong(DateTime.UtcNow);
     MRSService.serviceStartTime = DateTime.UtcNow;
 }
示例#5
0
 private static void InitializeAuthZPluginForRemotePS(string connectionUri)
 {
     if (AppSettings.RpsAuthZAppSettingsInitialized)
     {
         return;
     }
     AppSettings.InitializeManualLoadAppSettings(connectionUri, delegate
     {
         IAppSettings appSettings = AppSettings.Current;
         if (appSettings.SupportedEMCVersions == null)
         {
             ((ManualLoadAppSettings)appSettings).SupportedEMCVersions = SupportedVersionList.DefaultVersionString;
         }
         AppDomain.CurrentDomain.SetupInformation.ConfigurationFile = appSettings.ConfigurationFilePath;
         ConfigFiles.SetConfigSource(appSettings.VDirName, appSettings.WebSiteName);
         FailFastUserCache.FailFastEnabled = appSettings.FailFastEnabled;
         Uri uri = new Uri(connectionUri, UriKind.Absolute);
         ExchangeAuthorizationPlugin.InitializeExchangeAuthZPluginPerfCounter(appSettings.VDirName, uri.Port);
         ProvisioningCache.InitializeAppRegistrySettings(appSettings.ProvisioningCacheIdentification);
         ThreadPool.SetMaxThreads(appSettings.ThreadPoolMaxThreads, appSettings.ThreadPoolMaxCompletionPorts);
         ThrottlingPerfCounterWrapper.Initialize(BudgetType.PowerShell);
         ADSession.DisableAdminTopologyMode();
     });
 }
示例#6
0
        // Token: 0x06000110 RID: 272 RVA: 0x00008194 File Offset: 0x00006394
        public static void Main(string[] args)
        {
            int num = Privileges.RemoveAllExcept(new string[]
            {
                "SeAuditPrivilege",
                "SeChangeNotifyPrivilege",
                "SeCreateGlobalPrivilege"
            });

            if (num != 0)
            {
                Environment.Exit(num);
            }
            if (!Debugger.IsAttached)
            {
                ExWatson.Register();
            }
            LogSearchService.runningAsService = !Environment.UserInteractive;
            bool flag  = false;
            bool flag2 = false;

            foreach (string text in args)
            {
                if (text.StartsWith("-?", StringComparison.Ordinal))
                {
                    LogSearchService.Usage();
                    Environment.Exit(0);
                }
                else if (text.StartsWith("-console"))
                {
                    flag = true;
                }
                else if (text.StartsWith("-wait"))
                {
                    flag2 = true;
                }
            }
            Globals.InitializeMultiPerfCounterInstance("LogSearchSvc");
            ADSession.DisableAdminTopologyMode();
            if (!LogSearchService.runningAsService)
            {
                if (!flag)
                {
                    LogSearchService.Usage();
                    Environment.Exit(0);
                }
                Console.WriteLine("Starting {0}, running in console mode.", Assembly.GetExecutingAssembly().GetName().Name);
                if (flag2)
                {
                    Console.WriteLine("Press ENTER to continue.");
                    Console.ReadLine();
                }
            }
            SettingOverrideSync.Instance.Start(true);
            if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Transport.ADExceptionHandling.Enabled)
            {
                LogSearchService.logSearchService = new LogSearchService(!LogSearchService.runningAsService);
            }
            else
            {
                ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
                {
                    LogSearchService.logSearchService = new LogSearchService(!LogSearchService.runningAsService);
                }, 0);
                if (!adoperationResult.Succeeded)
                {
                    ExTraceGlobals.ServiceTracer.TraceError <Exception>(0L, "Create Log Search Service failed: {0}", adoperationResult.Exception);
                    Environment.Exit(1);
                }
            }
            try
            {
                Kerberos.FlushTicketCache();
            }
            catch (Win32Exception arg)
            {
                ExTraceGlobals.ServiceTracer.TraceDebug <Win32Exception>(0L, "MsExchangeLogSearch caught a Win32Exception when flushing the Kerberos Ticket Cache at startup: {0}", arg);
            }
            if (!LogSearchService.runningAsService)
            {
                LogSearchService.logSearchService.OnStartInternal(args);
                bool flag3 = false;
                while (!flag3)
                {
                    Console.WriteLine("Enter 'q' to shutdown.");
                    string text2 = Console.ReadLine();
                    if (string.IsNullOrEmpty(text2))
                    {
                        break;
                    }
                    switch (text2[0])
                    {
                    case 'q':
                        flag3 = true;
                        break;

                    case 's':
                        LogSearchService.logSearchService.sessionManager.ShowSessions();
                        break;
                    }
                }
                Console.WriteLine("Shutting down ...");
                LogSearchService.logSearchService.OnStopInternal();
                Console.WriteLine("Done.");
                return;
            }
            ServiceBase.Run(LogSearchService.logSearchService);
        }
示例#7
0
 private void InitDirectoryTopologyMode()
 {
     ADSession.DisableAdminTopologyMode();
 }