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);
     }
 }
Example #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
     });
 }
Example #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);
        }
        // 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]);
                }
            }
        }
Example #5
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);
 }
 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);
     }
 }
 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();
     }
 }
        // 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();
                    }
                }
            }
        }
Example #9
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();
                    }
                }
            }
        }
Example #10
0
 // Token: 0x06000059 RID: 89 RVA: 0x00002F0E File Offset: 0x0000110E
 protected virtual void RegisterDiagnosticComponents()
 {
     ProcessAccessManager.RegisterComponent(this);
 }