// Token: 0x0600002B RID: 43 RVA: 0x000035DC File Offset: 0x000017DC
 internal override void OnStart()
 {
     lock (ModeratedDLApplication.SyncRoot)
     {
         if (ModeratedDLApplication.refCount == 0)
         {
             MessageTrackingLog.Start("MSGTRKMA");
             Server server = null;
             ADNotificationAdapter.TryRunADOperation(delegate()
             {
                 ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 144, "OnStart", "f:\\15.00.1497\\sources\\dev\\Approval\\src\\Applications\\ModeratedDLApplication\\ModeratedDLApplication.cs");
                 this.serverConfigNotificationCookie = ADNotificationAdapter.RegisterChangeNotification <Server>(topologyConfigurationSession.GetOrgContainerId(), new ADNotificationCallback(ModeratedDLApplication.ServerChangeCallback));
                 server = topologyConfigurationSession.ReadLocalServer();
                 Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain acceptedDomain = topologyConfigurationSession.GetDefaultAcceptedDomain();
                 if (acceptedDomain != null && acceptedDomain.DomainName.SmtpDomain != null)
                 {
                     this.defaultAcceptedDomain = acceptedDomain.DomainName.SmtpDomain.Domain;
                 }
             });
             if (server == null)
             {
                 ModeratedDLApplication.diag.TraceError((long)this.GetHashCode(), "Cannot read local server for message tracking");
             }
             MessageTrackingLog.Configure(server);
         }
         ModeratedDLApplication.refCount++;
     }
     base.OnStart();
 }
예제 #2
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();
                    }
                }
            }
        }