public void Start(bool initiallyPaused, ServiceState targetRunningState)
 {
     lock (this.syncObject)
     {
         ADNotificationAdapter.RunADOperation(delegate()
         {
             try
             {
                 StoreDriverDelivery.localIp       = Dns.GetHostEntry("localhost");
                 StoreDriverDelivery.localFqdn     = StoreDriverDelivery.localIp.HostName;
                 StoreDriverDelivery.localDomain   = StoreDriverDelivery.GetDomainNameFromFqdn(StoreDriverDelivery.localFqdn);
                 StoreDriverDelivery.localHostName = StoreDriverDelivery.GetShortNameFromFqdn(StoreDriverDelivery.localFqdn);
             }
             catch (SocketException ex)
             {
                 StoreDriverDeliveryDiagnostics.Diag.TraceError <string>(0L, "Start failed: {0}", ex.ToString());
                 StoreDriverDeliveryDiagnostics.LogEvent(MailboxTransportEventLogConstants.Tuple_StoreDriverGetLocalIPFailure, null, new object[]
                 {
                     ex
                 });
                 throw new TransportComponentLoadFailedException(ex.Message, ex);
             }
             ProcessAccessManager.RegisterComponent(this);
             StoreDriverDeliveryDiagnostics.Diag.TraceDebug(0L, "Start delivery");
         }, 1);
     }
 }
Esempio n. 2
0
 // Token: 0x060005E5 RID: 1509 RVA: 0x00020E68 File Offset: 0x0001F068
 private void Application_Start(object sender, EventArgs e)
 {
     Diagnostics.InitializeWatsonReporting();
     if (Globals.InstanceType == null)
     {
         string text = HttpProxyGlobals.ProtocolType.ToString();
         text = "FE_" + text;
         Globals.InitializeMultiPerfCounterInstance(text);
     }
     Diagnostics.SendWatsonReportOnUnhandledException(delegate()
     {
         ProcessAccessManager.RegisterComponent(SettingOverrideSync.Instance);
         CertificateValidationManager.RegisterCallback(Constants.CertificateValidationComponentId, ProxyApplication.RemoteCertificateValidationCallback);
         ProxyApplication.ConfigureServicePointManager();
         if (DownLevelServerManager.IsApplicable)
         {
             DownLevelServerManager.Instance.Initialize();
         }
     });
     PerfCounters.UpdateHttpProxyPerArrayCounters();
     Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_ApplicationStart, null, new object[]
     {
         HttpProxyGlobals.ProtocolType
     });
 }
Esempio n. 3
0
        // Token: 0x0600000E RID: 14 RVA: 0x0000251C File Offset: 0x0000071C
        private bool StartServicelet(IServicelet servicelet)
        {
            bool result;

            try
            {
                if (!servicelet.IsEnabled)
                {
                    this.logger.Log(MigrationEventType.Information, "Servicelet {0} is not enabled, skipped.", new object[]
                    {
                        servicelet.Name
                    });
                    result = false;
                }
                else
                {
                    this.logger.Log(MigrationEventType.Information, "Starting servicelet {0}.", new object[]
                    {
                        servicelet.Name
                    });
                    this.logger.Log(MigrationEventType.Verbose, "Initializing servicelet.", new object[0]);
                    if (!servicelet.Initialize())
                    {
                        this.logger.Log(MigrationEventType.Verbose, "Servicelet did not initialize, not starting it.", new object[0]);
                        result = false;
                    }
                    else
                    {
                        this.logger.Log(MigrationEventType.Verbose, "Registering diagnostics interfaces.", new object[0]);
                        foreach (IDiagnosable diagnosable in servicelet.GetDiagnosableComponents())
                        {
                            ProcessAccessManager.RegisterComponent(diagnosable);
                        }
                        MigrationWorkflowServiceHost.StartServiceletThread(servicelet);
                        result = true;
                    }
                }
            }
            catch (Exception ex)
            {
                this.LogEvent(MWSEventLogConstants.Tuple_ServiceletFailedToStart, new object[]
                {
                    servicelet.Name,
                    CommonUtils.FullExceptionMessage(ex, true)
                });
                this.logger.LogError(ex, "Servicelet {0} failed to start.", new object[]
                {
                    servicelet.Name
                });
                if (!(ex is LocalizedException))
                {
                    throw;
                }
                result = false;
            }
            return(result);
        }
Esempio n. 4
0
        protected override void InternalProcessRecord()
        {
            string userIdentity            = (base.ExchangeRunspaceConfig == null) ? string.Empty : base.ExchangeRunspaceConfig.IdentityName;
            bool   componentRestrictedData = GetExchangeDiagnosticInfo.CheckDataRedactionEnabled(this.serverVersion) && !base.NeedSuppressingPiiData;
            string xml    = ProcessAccessManager.ClientRunProcessCommand(this.serverFqdn, this.Process, this.Component, this.Argument, componentRestrictedData, this.Unlimited, userIdentity);
            string result = GetExchangeDiagnosticInfo.ReformatXml(xml);

            this.WriteResult(new ExchangeDiagnosticInfoResult(result));
        }
Esempio n. 5
0
 // Token: 0x060005E6 RID: 1510 RVA: 0x00020EF4 File Offset: 0x0001F0F4
 private void Application_End(object sender, EventArgs e)
 {
     Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_ApplicationShutdown, null, new object[]
     {
         HttpProxyGlobals.ProtocolType
     });
     RequestDetailsLogger.FlushQueuedFileWrites();
     ProcessAccessManager.UnregisterComponent(SettingOverrideSync.Instance);
 }
 public void Unload()
 {
     lock (this.syncObject)
     {
         ProcessAccessManager.UnregisterComponent(this);
     }
     MExEvents.Shutdown();
     StoreDriverSubmission.ShutdownPerformanceCounterMaintenance();
 }
        // 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]);
                }
            }
        }
Esempio n. 8
0
 public void StartService()
 {
     MRSService.scheduledLogsList.Add(new MRSSettingsLog());
     MailboxSyncerJobs.StartScheduling();
     MRSService.jobPoller.Start();
     MRSService.lightJobPoller.Start();
     MRSService.issueCache.EnableScanning();
     MRSService.logDumper.Start();
     ProcessAccessManager.RegisterComponent(this);
     ProcessAccessManager.RegisterComponent(MRSService.issueCache);
     ProcessAccessManager.RegisterComponent(ConfigBase <MRSConfigSchema> .Provider);
 }
 public void Stop()
 {
     this.storeDriverTracer.StoreDriverSubmissionTracer.TracePass(this.storeDriverTracer.MessageProbeActivityId, 0L, "Stop StoreDriverSubmission");
     if (!this.stopped)
     {
         this.stopped = true;
     }
     lock (this.syncObject)
     {
         this.StopSubmission();
         ProcessAccessManager.UnregisterComponent(this);
     }
 }
 public void Stop()
 {
     StoreDriverDeliveryDiagnostics.Diag.TraceDebug(0L, "Stop StoreDriverDelivery");
     if (!this.retired)
     {
         this.Retire();
     }
     lock (this.syncObject)
     {
         this.StopDelivery();
         ProcessAccessManager.UnregisterComponent(this);
     }
 }
Esempio n. 11
0
 public void StopService()
 {
     MrsTracer.Service.Debug("Stopping service...", new object[0]);
     CommonUtils.ServiceIsStopping = true;
     MRSService.lightJobPoller.WaitForJobToBeDone();
     MRSService.jobPoller.WaitForJobToBeDone();
     MailboxSyncerJobs.WaitForAllJobsToComplete();
     ProcessAccessManager.UnregisterComponent(ConfigBase <MRSConfigSchema> .Provider);
     ProcessAccessManager.UnregisterComponent(MRSService.issueCache);
     ProcessAccessManager.UnregisterComponent(this);
     MailboxSyncerJobs.StopScheduling();
     MRSService.LogEvent(MRSEventLogConstants.Tuple_ServiceStopped, new object[0]);
     MrsTracer.Service.Debug("Service stopped.", new object[0]);
 }
 // Token: 0x06000005 RID: 5 RVA: 0x00002438 File Offset: 0x00000638
 protected override void OnStopInternal()
 {
     Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStopping, null, new object[0]);
     AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Stopping the Mailbox Assistants Service", 32151);
     if (this.memoryMonitor != null)
     {
         this.memoryMonitor.Stop();
     }
     if (this.watermarkCleanupTimer != null)
     {
         this.watermarkCleanupTimer.Dispose();
     }
     if (this.databaseManager != null)
     {
         try
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 this.databaseManager.Stop();
             });
         }
         catch (GrayException arg)
         {
             AssistantsService.Tracer.TraceDebug <AssistantsService, GrayException>((long)this.GetHashCode(), "{0}: Gray Exception reported during shutdown: {1}", this, arg);
         }
         finally
         {
             this.databaseManager.Dispose();
         }
         AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Stopping the Assistant Infrastructure", 17815);
     }
     MailboxSearchServer.StopServer();
     AssistantsLog.LogServiceStopEvent(this.activityId);
     AssistantsLog.Stop();
     MailboxAssistantsSlaReportLogFactory.StopAll();
     using (Process currentProcess = Process.GetCurrentProcess())
     {
         Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStopped, null, new object[]
         {
             currentProcess.Id,
             "Microsoft Exchange",
             "15.00.1497.010"
         });
     }
     ProcessAccessManager.UnregisterComponent(this);
     ProcessAccessManager.UnregisterComponent(SettingOverrideSync.Instance);
     SettingOverrideSync.Instance.Stop();
     AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} The Mailbox Assistants Service Stopped successfully", 21911);
 }
Esempio n. 13
0
        // Token: 0x06000006 RID: 6 RVA: 0x00002558 File Offset: 0x00000758
        protected override void OnStopInternal()
        {
            MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StopService);
            MailboxTransportDeliveryService.isExiting = true;
            ADNotificationListener.Stop();
            MailboxTransportDeliveryService.diag.TraceDebug <DateTime>(0L, "Stopping MailTransportDeliveryService ({0})", DateTime.UtcNow);
            bool flag = false;

            try
            {
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StopBackgroundThread);
                if (MailboxTransportDeliveryService.backgroundThread != null)
                {
                    MailboxTransportDeliveryService.backgroundThread.Stop();
                }
                if (this.isDiagnosticHandlerRegisteredForSettingOverrideSync)
                {
                    try
                    {
                        ProcessAccessManager.UnregisterComponent(SettingOverrideSync.Instance);
                    }
                    catch (RpcException ex)
                    {
                        MailboxTransportDeliveryService.diag.TraceError <string>(0L, "Failed to unregister SettingOverride component with Rpc Server. Error : {0}", ex.ToString());
                    }
                }
                SettingOverrideSync.Instance.Stop();
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StopMessageTracking);
                MessageTrackingLog.Stop();
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StopConfiguration);
                DeliveryConfiguration.Instance.Unload();
                MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStopSuccess, null, new string[0]);
                MailboxTransportDeliveryService.diag.TraceDebug(0L, "Stopped MailboxDeliveryService");
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.UngregisterPamComponent);
                ProcessAccessManager.UnregisterComponent(this);
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.ServiceStopped);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStopFailure, null, new string[0]);
                    MailboxTransportDeliveryService.diag.TraceError(0L, "Failed to stop MailboxDeliveryService");
                }
            }
            DeliveryThrottling.Instance.Dispose();
        }
 private void StartSubmission()
 {
     try
     {
         ProcessAccessManager.RegisterComponent(this);
     }
     catch (Exception ex)
     {
         this.storeDriverTracer.StoreDriverSubmissionTracer.TraceFail <string>(this.storeDriverTracer.MessageProbeActivityId, 0L, "Failed to start Store Driver Submission: {0}", ex.ToString());
         StoreDriverSubmission.LogEvent(MSExchangeStoreDriverSubmissionEventLogConstants.Tuple_StoreDriverSubmissionStartFailure, null, new object[]
         {
             ex
         });
         throw new TransportComponentLoadFailedException(ex.Message, ex);
     }
 }
Esempio n. 15
0
 public void Refresh()
 {
     for (int i = 1; i <= DiagnosticInfo.RetryCount + 1; i++)
     {
         string text = ProcessAccessManager.ClientRunProcessCommand(this.serverName, "Microsoft.Exchange.Search.Service", null, null, false, true, null);
         this.Parse(text);
         if (this.ProcessId != null || DiagnosticInfo.RetryCount == 0)
         {
             this.DiagnosticInfoXml = text;
             return;
         }
         if (i == DiagnosticInfo.RetryCount + 1)
         {
             throw new InvalidOperationException(string.Format("Process ID is not found from diagnostic info XML:\n{0}", text));
         }
         Thread.Sleep(TimeSpan.FromSeconds(3.0));
     }
 }
Esempio n. 16
0
        public static XElement QueryMRSDiagnostics(string serverName, string arguments, string xPath, string componentName = "MailboxReplicationService")
        {
            string   text = ProcessAccessManager.ClientRunProcessCommand(serverName, "MSExchangeMailboxReplication", componentName, arguments, false, true, string.Empty);
            XElement xelement;

            try
            {
                xelement = XElement.Parse(text);
            }
            catch (XmlException ex)
            {
                throw new MRSDiagnosticXmlParsingException(ex.Message, text, ex);
            }
            xelement = xelement.XPathSelectElement(xPath);
            if (xelement == null)
            {
                throw new MRSExpectedDiagnosticsElementMissingException(xPath, text);
            }
            return(xelement);
        }
        // Token: 0x06000019 RID: 25 RVA: 0x00002A5C File Offset: 0x00000C5C
        private void OnStopInternalHelper()
        {
            MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopService);
            ADNotificationListener.Stop();
            MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TracePass <DateTime>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "Stopping MailboxTransportSubmissionService ({0})", DateTime.UtcNow);
            bool flag = false;

            try
            {
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopBackgroundThread);
                if (MailboxTransportSubmissionService.backgroundThread != null)
                {
                    MailboxTransportSubmissionService.backgroundThread.Stop();
                }
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopDatabaseManager);
                if (this.databaseManager != null)
                {
                    this.databaseManager.Stop();
                    this.databaseManager.Dispose();
                }
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopMessageTracking);
                MessageTrackingLog.Stop();
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopConfiguration);
                SubmissionConfiguration.Instance.Unload();
                MailboxTransportSubmissionEventLogger.LogEvent(MSExchangeSubmissionEventLogConstants.Tuple_SubmissionServiceStopSuccess, null, new object[0]);
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TracePass(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "Stopped MailboxTransportSubmissionService");
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.UngregisterPamComponent);
                ProcessAccessManager.UnregisterComponent(this);
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.ServiceStopped);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    MailboxTransportSubmissionEventLogger.LogEvent(MSExchangeSubmissionEventLogConstants.Tuple_SubmissionServiceStopFailure, null, new object[0]);
                    MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TraceFail(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "Failed to stop MailboxTransportSubmissionService");
                }
            }
        }
 public void Load()
 {
     lock (this.syncObject)
     {
         ProcessAccessManager.RegisterComponent(this);
     }
     try
     {
         MExEvents.Initialize(Path.Combine(ConfigurationContext.Setup.InstallPath, "TransportRoles\\Shared\\agents.config"), ProcessTransportRole.MailboxSubmission, LatencyAgentGroup.MailboxTransportSubmissionStoreDriverSubmission, "Microsoft.Exchange.Data.Transport.StoreDriver.StoreDriverAgent");
         StoreDriverSubmission.InitializePerformanceCounterMaintenance();
     }
     catch (ExchangeConfigurationException ex)
     {
         this.storeDriverTracer.StoreDriverSubmissionTracer.TraceFail(this.storeDriverTracer.MessageProbeActivityId, (long)this.GetHashCode(), "StoreDriversubmission.Load threw ExchangeConfigurationException: shutting down service.");
         StoreDriverSubmission.LogEvent(MSExchangeStoreDriverSubmissionEventLogConstants.Tuple_CannotStartAgents, null, new object[]
         {
             ex.LocalizedString,
             ex
         });
         this.Stop();
     }
 }
Esempio n. 19
0
 // Token: 0x0600000A RID: 10 RVA: 0x00002368 File Offset: 0x00000568
 protected override void OnStopInternal()
 {
     this.serviceStopHandle.Set();
     this.logger.Log(MigrationEventType.Verbose, "Stopping MSExchangeWorkflow service.", new object[0]);
     if (this.servicelets != null)
     {
         foreach (IServicelet servicelet in this.servicelets)
         {
             this.logger.Log(MigrationEventType.Information, "Stopping servicelet {0}.", new object[]
             {
                 servicelet.Name
             });
             this.logger.Log(MigrationEventType.Verbose, "Un-registering diagnostics interfaces.", new object[0]);
             foreach (IDiagnosable diagnosable in servicelet.GetDiagnosableComponents())
             {
                 ProcessAccessManager.UnregisterComponent(diagnosable);
             }
             servicelet.Stop();
         }
     }
     this.logger.Log(MigrationEventType.Verbose, "MSExchangeWorkflow service stopped.", new object[0]);
     this.LogEvent(MWSEventLogConstants.Tuple_ServiceStopped, new object[0]);
 }
Esempio n. 20
0
        // Token: 0x06000005 RID: 5 RVA: 0x00002340 File Offset: 0x00000540
        protected override void OnStartInternal(string[] args)
        {
            MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StartService);
            MailboxTransportDeliveryService.diag.TracePfd <int, DateTime>(0L, "PFD EMS {0} Starting MailboxDeliveryService ({1})", 24475, DateTime.UtcNow);
            bool   flag  = false;
            bool   flag2 = false;
            string text  = string.Empty;

            try
            {
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.RegisterPamComponent);
                ProcessAccessManager.RegisterComponent(this);
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StartMessageTracking);
                MessageTrackingLog.Start("MSGTRKMD");
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.LoadConfiguration);
                StorageExceptionHandler.Init();
                DeliveryConfiguration.Instance.Load(MailboxTransportDeliveryService.messageListener);
                try
                {
                    ProcessAccessManager.RegisterComponent(SettingOverrideSync.Instance);
                    this.isDiagnosticHandlerRegisteredForSettingOverrideSync = true;
                }
                catch (RpcException ex)
                {
                    MailboxTransportDeliveryService.diag.TraceError <string>(0L, "Failed to register SettingOverride component with Rpc Server. Error : {0}", ex.ToString());
                }
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StartBackgroundThread);
                MailboxTransportDeliveryService.backgroundThread = new BackgroundThreadDelivery();
                MailboxTransportDeliveryService.backgroundThread.Start(false, ServiceState.Active);
                MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStartSuccess, null, new string[0]);
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.ServiceStarted);
                MailboxTransportDeliveryService.diag.TracePfd <int>(0L, "PFD EMS {0} MailTransportDeliveryService Started", 26523);
                flag = true;
            }
            catch (ADTransientException ex2)
            {
                MailboxTransportDeliveryService.diag.TraceError <string>(0L, "Failed to start MailboxDeliveryService. Error: {0}", ex2.ToString());
                MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStartFailure, null, new string[]
                {
                    ex2.ToString()
                });
                MailboxTransportDeliveryService.PublishServiceStartFailureNotification(ex2.Message);
                Environment.Exit(1);
            }
            catch (ConfigurationErrorsException ex3)
            {
                text  = ex3.Message;
                flag2 = true;
            }
            catch (HandlerParseException ex4)
            {
                text  = ex4.Message;
                flag2 = true;
            }
            finally
            {
                if (!flag)
                {
                    MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStartFailure, null, new string[]
                    {
                        text
                    });
                    MailboxTransportDeliveryService.PublishServiceStartFailureNotification(text);
                    MailboxTransportDeliveryService.diag.TraceError(0L, "Failed to start MailboxDeliveryService");
                    if (flag2)
                    {
                        base.Stop();
                    }
                }
            }
        }
Esempio n. 21
0
 // Token: 0x0600005A RID: 90 RVA: 0x00002F16 File Offset: 0x00001116
 protected virtual void UnregisterDiagnosticComponents()
 {
     ProcessAccessManager.UnregisterComponent(this);
 }
        // Token: 0x06000018 RID: 24 RVA: 0x0000283C File Offset: 0x00000A3C
        private void OnStartInternalHelper()
        {
            MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StartService);
            MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TracePfdPass <int, DateTime>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "PFD EMS {0} Starting MailboxTransportSubmissionService ({1})", 24475, DateTime.UtcNow);
            bool   flag  = false;
            bool   flag2 = false;
            string text  = null;

            try
            {
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.RegisterPamComponent);
                ProcessAccessManager.RegisterComponent(this);
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.InitializePerformanceMonitoring);
                MailboxTransportSubmissionService.InitializePerfMon();
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TracePfdPass <int, DateTime>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "PFD EMS {0} Finished Loading Perfmon ({1})", 32667, DateTime.UtcNow);
                TransportADNotificationAdapter.Instance.RegisterForSubmissionServiceEvents();
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.LoadConfiguration);
                StorageExceptionHandler.Init();
                this.ConstructComponentLoadTree();
                SubmissionConfiguration.Instance.Load();
                int num;
                ThreadPool.GetMaxThreads(out this.maxThreads, out num);
                ITimeBasedAssistantType[]  timeBasedAssistantTypeArray  = null;
                IEventBasedAssistantType[] eventBasedAssistantTypeArray = new IEventBasedAssistantType[]
                {
                    new MailboxTransportSubmissionAssistantType()
                };
                this.databaseManager = new DatabaseManager("Microsoft Exchange Mailbox Transport Submission", MailboxTransportSubmissionAssistant.MaxConcurrentSubmissions, eventBasedAssistantTypeArray, timeBasedAssistantTypeArray, false);
                MailboxTransportSubmissionEventLogger.LogEvent(MSExchangeSubmissionEventLogConstants.Tuple_SubmissionServiceStartSuccess, null, new object[0]);
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.CreateBackgroundThread);
                MailboxTransportSubmissionService.backgroundThread = new BackgroundProcessingThread();
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StartBackgroundThread);
                MailboxTransportSubmissionService.backgroundThread.Start(false, ServiceState.Active);
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StartDatabaseManager);
                this.databaseManager.Start();
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.ServiceStarted);
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TracePfdPass <int>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "PFD EMS {0} MailTransportSubmissionService Started", 26523);
                flag = true;
            }
            catch (ConfigurationErrorsException ex)
            {
                text  = ex.Message;
                flag2 = true;
            }
            catch (HandlerParseException ex2)
            {
                text  = ex2.Message;
                flag2 = true;
            }
            finally
            {
                if (!flag)
                {
                    MailboxTransportSubmissionEventLogger.LogEvent(MSExchangeSubmissionEventLogConstants.Tuple_SubmissionServiceStartFailure, null, new object[]
                    {
                        text
                    });
                    MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TracePfdPass(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "Failed to start MailboxTransportSubmissionService");
                    base.ExRequestAdditionalTime(60000);
                    if (flag2)
                    {
                        base.Stop();
                    }
                }
            }
        }