public static bool Start(TimeSpan enqueueRequestTimeout, out Exception e) { RpcServerWrapper.enqueueRequestTimeout = enqueueRequestTimeout; e = null; if (RpcServerWrapper.Registered == 1) { return(true); } SecurityIdentifier securityIdentifier = new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null); FileSystemAccessRule accessRule = new FileSystemAccessRule(securityIdentifier, FileSystemRights.Read, AccessControlType.Allow); FileSecurity fileSecurity = new FileSecurity(); fileSecurity.SetOwner(securityIdentifier); fileSecurity.SetAccessRule(accessRule); bool result; try { RpcServerBase.RegisterServer(typeof(RpcServerWrapper), fileSecurity, 131209); Interlocked.CompareExchange(ref RpcServerWrapper.Registered, 1, 0); result = true; } catch (RpcException ex) { e = ex; Interlocked.CompareExchange(ref RpcServerWrapper.Registered, 0, 1); result = false; } return(result); }
// Token: 0x06000028 RID: 40 RVA: 0x00002A38 File Offset: 0x00000C38 private static bool TryRegisterRpcServer(ObjectSecurity rpcSecurityDescriptor, out ThrottlingRpcServerImpl serverInstance) { ThrottlingService.StartStopBreadcrumbs.Drop("Trying to register RPC server", new object[0]); ThrottlingService.Tracer.TraceDebug(0L, "Trying to register RPC server"); serverInstance = null; try { serverInstance = (ThrottlingRpcServerImpl)RpcServerBase.RegisterServer(typeof(ThrottlingRpcServerImpl), rpcSecurityDescriptor, 1, false, ThrottlingRpcServerImpl.GetThreadPoolSize()); } catch (RpcException ex) { ThrottlingService.StartStopBreadcrumbs.Drop("Failed to register RPC server: {0}", new object[] { ex }); ThrottlingService.Tracer.TraceError <RpcException>(0L, "Failed to register RPC server: {0}", ex); ThrottlingService.EventLogger.LogEvent(ThrottlingServiceEventLogConstants.Tuple_RegisterRpcServerFailure, null, new object[] { ex }); return(false); } ThrottlingService.StartStopBreadcrumbs.Drop("Successfully registered RPC server", new object[0]); ThrottlingService.Tracer.TraceDebug(0L, "Successfully registered RPC server"); return(true); }
internal static void StartServer() { SecurityIdentifier securityIdentifier = new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null); FileSystemAccessRule accessRule = new FileSystemAccessRule(securityIdentifier, FileSystemRights.ReadData, AccessControlType.Allow); FileSecurity fileSecurity = new FileSecurity(); fileSecurity.SetOwner(securityIdentifier); fileSecurity.SetAccessRule(accessRule); MailboxSearchServer.server = (MailboxSearchServer)RpcServerBase.RegisterServer(typeof(MailboxSearchServer), fileSecurity, 1); MailboxSearchServer.server.InternalStart(); }
// Token: 0x060000CA RID: 202 RVA: 0x00005420 File Offset: 0x00003620 public static void StartServer(SecurityIdentifier exchangeServersSid) { SecurityIdentifier securityIdentifier = new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null); FileSystemAccessRule accessRule = new FileSystemAccessRule(securityIdentifier, FileSystemRights.ReadData, AccessControlType.Allow); SecurityIdentifier identity = new SecurityIdentifier(WellKnownSidType.LocalSystemSid, null); FileSystemAccessRule rule = new FileSystemAccessRule(identity, FileSystemRights.ReadData, AccessControlType.Allow); FileSystemAccessRule rule2 = new FileSystemAccessRule(exchangeServersSid, FileSystemRights.ReadData, AccessControlType.Allow); FileSecurity fileSecurity = new FileSecurity(); fileSecurity.SetOwner(securityIdentifier); fileSecurity.SetAccessRule(accessRule); fileSecurity.AddAccessRule(rule); fileSecurity.AddAccessRule(rule2); RpcServerBase.RegisterServer(typeof(AssistantsRpcServer), fileSecurity, 1); }
public static bool Start(out Exception e) { e = null; SecurityIdentifier securityIdentifier = new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null); FileSystemAccessRule accessRule = new FileSystemAccessRule(securityIdentifier, FileSystemRights.Read, AccessControlType.Allow); FileSecurity fileSecurity = new FileSecurity(); fileSecurity.SetOwner(securityIdentifier); fileSecurity.SetAccessRule(accessRule); bool result; try { ExchangeCertificateServer.server = (ExchangeCertificateServer)RpcServerBase.RegisterServer(typeof(ExchangeCertificateServer), fileSecurity, 1, false); result = true; } catch (RpcException ex) { e = ex; result = false; } return(result); }
// Token: 0x0600011A RID: 282 RVA: 0x00008870 File Offset: 0x00006A70 private void Initialize(Server server, ObjectSecurity adminSecurity) { ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch service is entering Initialize"); bool flag = false; LogSearchService.LogSearchServiceStartState logSearchServiceStartState = LogSearchService.LogSearchServiceStartState.Init; try { this.sessionManager = new LogSessionManager(); this.sessionManager.Start(); logSearchServiceStartState = LogSearchService.LogSearchServiceStartState.SessionManagerStartup; if (server.IsHubTransportServer) { EHALogSearchComponent.Start(server.Name); } if (LogSearchAppConfig.Instance.HealthMonitoringLog == null) { ExTraceGlobals.ServiceTracer.TraceError((long)this.GetHashCode(), "Health monitoring log could not be initialized, service will be stopped"); } else { this.healthLog = new HealthMonitoringLog(); this.healthLog.Configure(LogSearchAppConfig.Instance.HealthMonitoringLog); logSearchServiceStartState = LogSearchService.LogSearchServiceStartState.HealthMonitoringLogStartup; this.ConfigureTransportSyncComponent(server); logSearchServiceStartState = LogSearchService.LogSearchServiceStartState.SyncHealthLogStartup; if (server.MessageTrackingLogPath != null && !string.IsNullOrEmpty(server.MessageTrackingLogPath.PathName)) { this.messageTrackingLog = new Log(MessageTrackingSchema.MessageTrackingEvent, server.MessageTrackingLogPath.ToString(), "MSGTRK", server.Name, "LOG", LogSearchIndexingParameters.MessageTrackingIndexPercentageByPrefix); this.messageTrackingLog.Config(server.MessageTrackingLogPath.ToString()); this.messageTrackingLog.Start(); this.sessionManager.RegisterLog("MSGTRK", this.messageTrackingLog); logSearchServiceStartState = LogSearchService.LogSearchServiceStartState.MessageTrackingLogStartup; } else if (!server.IsClientAccessServer) { LogSearchService.logger.LogEvent(MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchNullOrEmptyLogPath, null, new object[0]); EventNotificationItem.Publish(ExchangeComponent.Transport.Name, "TransportLogSearch", null, "The Microsoft Exchange Transport Log Search service failed because the parameter that sets the location of the message tracking logs was set to an invalid value.", ResultSeverityLevel.Warning, false); } ActiveDirectoryRights accessMask = ActiveDirectoryRights.GenericRead; bool flag2 = !server.IsHubTransportServer && !server.IsMailboxServer; LogSearchService.logSearchServer = (LogSearchServer)RpcServerBase.RegisterServer(typeof(LogSearchServer), adminSecurity, accessMask, flag2); ExTraceGlobals.ServiceTracer.TraceDebug <bool>((long)this.GetHashCode(), "RPC is registered. LocalRpcOnly = {0}", flag2); LogSearchService.logSearchServer.SessionManager = this.sessionManager; flag = true; } } finally { if (!flag) { if (this.sessionManager != null) { this.sessionManager.Stop(); this.sessionManager = null; } if (this.messageTrackingLog != null) { this.messageTrackingLog.Stop(); this.messageTrackingLog = null; } if (this.healthLog != null) { this.healthLog.Dispose(); this.healthLog = null; } switch (logSearchServiceStartState) { case LogSearchService.LogSearchServiceStartState.Init: { string text = "MsExchangeLogSearch services Initialize failure because session manager startup failed"; ExTraceGlobals.ServiceTracer.TraceError((long)this.GetHashCode(), text); LogSearchService.logger.LogEvent(MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchServiceStartFailureInit, null, new object[0]); EventNotificationItem.Publish(ExchangeComponent.Transport.Name, "TransportLogSearch", null, text, ResultSeverityLevel.Error, false); break; } case LogSearchService.LogSearchServiceStartState.SessionManagerStartup: { string text = "MsExchangeLogSearch services Initialize failure because message tracking log failed"; ExTraceGlobals.ServiceTracer.TraceError((long)this.GetHashCode(), text); LogSearchService.logger.LogEvent(MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchServiceStartFailureSessionManager, null, new object[0]); EventNotificationItem.Publish(ExchangeComponent.Transport.Name, "TransportLogSearch", null, text, ResultSeverityLevel.Error, false); break; } case LogSearchService.LogSearchServiceStartState.MessageTrackingLogStartup: { string text = "MsExchangeLogSearch services Initialize failure because RPC server startup failed"; ExTraceGlobals.ServiceTracer.TraceError((long)this.GetHashCode(), text); LogSearchService.logger.LogEvent(MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchServiceStartFailureMTGLog, null, new object[0]); EventNotificationItem.Publish(ExchangeComponent.Transport.Name, "TransportLogSearch", null, text, ResultSeverityLevel.Error, false); break; } } } } }
// Token: 0x0600045A RID: 1114 RVA: 0x00016E6C File Offset: 0x0001506C public static bool TryStart(ActiveManagerCore amInstance) { bool fRpcServerStarted; lock (AmRpcServer.m_locker) { if (!AmRpcServer.m_fRpcServerStarted) { AmTrace.Debug("Starting Active Manager Rpc", new object[0]); AmRpcServer.m_amInstance = amInstance; try { FileSecurity activeManagerRpcSecurity = Microsoft.Exchange.Cluster.Replay.ObjectSecurity.ActiveManagerRpcSecurity; if (activeManagerRpcSecurity != null) { AmRpcServer.m_rpcServer = (AmRpcServer)RpcServerBase.RegisterServer(typeof(AmRpcServer), activeManagerRpcSecurity, 1, false, (uint)RegistryParameters.MaximumRpcThreadCount); if (AmRpcServer.m_rpcServer != null) { AmTrace.Debug("Active Manager Rpc server successfully started.", new object[0]); AmRpcServer.m_fRpcServerStarted = true; } } if (AmRpcServer.m_rpcServer == null) { AmTrace.Error("Active Manager Rpc server failed to start!", new object[0]); ReplayEventLogConstants.Tuple_AmRpcServerFailedToStart.LogEvent(null, new object[0]); } goto IL_1BF; } catch (RpcException ex) { AmTrace.Error("RPC Error occurred while trying to register the Active Manager RPC Server. Exception: {0}", new object[] { ex.ToString() }); ReplayEventLogConstants.Tuple_AmRpcServerFailedToRegister.LogEvent(null, new object[] { ex.Message }); goto IL_1BF; } catch (ADTransientException ex2) { AmTrace.Error("Transient exception occurred while retrieving the ActiveManagerRpcSecurity object. Exception: {0}", new object[] { ex2.ToString() }); ReplayEventLogConstants.Tuple_AmRpcServerFailedToFindExchangeServersUsg.LogEvent(null, new object[] { ex2.Message }); goto IL_1BF; } catch (ADExternalException ex3) { AmTrace.Error("Start(): Permanent exception occurred while retrieving the ActiveManagerRpcSecurity object. Exception: {0}", new object[] { ex3.ToString() }); ReplayEventLogConstants.Tuple_AmRpcServerFailedToFindExchangeServersUsg.LogEvent(null, new object[] { ex3.Message }); goto IL_1BF; } catch (ADOperationException ex4) { AmTrace.Error("Start(): Permanent exception occurred while retrieving the ActiveManagerRpcSecurity object. Exception: {0}", new object[] { ex4.ToString() }); ReplayEventLogConstants.Tuple_AmRpcServerFailedToFindExchangeServersUsg.LogEvent(null, new object[] { ex4.Message }); goto IL_1BF; } } AmTrace.Debug("Active Manager RPC server already started.", new object[0]); IL_1BF: fRpcServerStarted = AmRpcServer.m_fRpcServerStarted; } return(fRpcServerStarted); }