// Token: 0x06002170 RID: 8560 RVA: 0x0009B6FF File Offset: 0x000998FF public RestartServerLocator(ServerLocatorManager serverLocatorManager, TimeSpan periodicStartInterval) : base(periodicStartInterval, periodicStartInterval, "RestartServerLocator") { this.m_serverLocatorManager = serverLocatorManager; }
// Token: 0x06002167 RID: 8551 RVA: 0x0009AC34 File Offset: 0x00098E34 public bool Start(out Exception ex) { ex = null; if (this.isRunning) { ServerLocatorManager.Tracer.TraceDebug(0L, "Server Locator Manager is already started."); return(true); } bool flag = false; bool result; try { object obj; Monitor.Enter(obj = ServerLocatorManager.syncRoot, ref flag); if (this.isRunning) { ServerLocatorManager.Tracer.TraceDebug(0L, "Server Locator Manager is already started."); result = true; } else { Exception serviceHostException = null; try { if (this.m_restartManager == null) { ServerLocatorManager.Tracer.TraceDebug(0L, "Creating restart manager that will constantly monitor service."); this.m_restartManager = new ServerLocatorManager.RestartServerLocator(this, ServerLocatorManager.restartInterval); this.m_restartManager.Start(); } ServerLocatorManager.Tracer.TraceDebug(0L, "Creating caching active manager client for Server Locator Service."); this.ADConfigProvider = Dependencies.MonitoringADConfigProvider; this.CopyStatusLookup = Dependencies.MonitoringCopyStatusClientLookup; this.Counters = ServerLocatorManager.GetPerfCounters(); ServerLocatorManager.Tracer.TraceDebug <string>(0L, "Starting Server Locator Service on {0}.", ServerLocatorManager.baseAddress.AbsoluteUri); this.serviceHost = new ServiceHost(typeof(ServerLocator), new Uri[] { ServerLocatorManager.baseAddress }); this.serviceHost.Faulted += this.RestartServiceHost; NetTcpBinding netTcpBinding = new NetTcpBinding(); netTcpBinding.MaxBufferPoolSize = 16777216L; netTcpBinding.MaxBufferSize = 16777216; netTcpBinding.MaxConnections = 200; netTcpBinding.MaxReceivedMessageSize = 16777216L; netTcpBinding.ReaderQuotas.MaxDepth = 128; netTcpBinding.ReaderQuotas.MaxArrayLength = int.MaxValue; netTcpBinding.ReaderQuotas.MaxBytesPerRead = int.MaxValue; netTcpBinding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue; netTcpBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue; this.serviceHost.AddServiceEndpoint(typeof(IServerLocator), netTcpBinding, "ServerLocator"); ServiceThrottlingBehavior serviceThrottlingBehavior = new ServiceThrottlingBehavior(); serviceThrottlingBehavior.MaxConcurrentCalls = RegistryParameters.WcfMaxConcurrentCalls; serviceThrottlingBehavior.MaxConcurrentSessions = RegistryParameters.WcfMaxConcurrentSessions; serviceThrottlingBehavior.MaxConcurrentInstances = RegistryParameters.WcfMaxConcurrentInstances; ServiceThrottlingBehavior serviceThrottlingBehavior2 = this.serviceHost.Description.Behaviors.Find <ServiceThrottlingBehavior>(); if (serviceThrottlingBehavior2 == null) { this.serviceHost.Description.Behaviors.Add(serviceThrottlingBehavior); } else { this.serviceHost.Description.Behaviors.Remove(serviceThrottlingBehavior2); this.serviceHost.Description.Behaviors.Add(serviceThrottlingBehavior); } ServiceMetadataBehavior item = new ServiceMetadataBehavior(); this.serviceHost.Description.Behaviors.Add(item); if (RegistryParameters.WcfEnableMexEndpoint) { ServerLocatorManager.Tracer.TraceDebug(0L, "Creating Mex binding."); ExAssert.RetailAssert(RegistryParameters.HighAvailabilityWebServiceMexPort != RegistryParameters.HighAvailabilityWebServicePort, "Metadata Exchange port should be different from Server Locator web service port."); Binding binding = MetadataExchangeBindings.CreateMexTcpBinding(); this.serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), binding, ServerLocatorManager.baseMetadataExchangeAddress); } InvokeWithTimeout.Invoke(delegate() { InvalidOperationException serviceHostException; try { this.serviceHost.Open(); } catch (InvalidOperationException serviceHostException) { serviceHostException = serviceHostException; } catch (CommunicationException serviceHostException2) { serviceHostException = serviceHostException2; } catch (SocketException serviceHostException3) { serviceHostException = serviceHostException3; } catch (Win32Exception serviceHostException4) { serviceHostException = serviceHostException4; } if (serviceHostException != null) { ServerLocatorManager.Tracer.TraceError <string>(0L, "InokeWithTimeout() failed to start Server Locator Service communication channel. Error: {0}", serviceHostException.Message); } }, ServerLocatorManager.startTimeout); if (serviceHostException == null) { this.isRunning = true; ServerLocatorManager.Tracer.TraceDebug(0L, "Server Locator Service started."); ReplayEventLogConstants.Tuple_ServerLocatorServiceStarted.LogEvent(null, new object[] { ServerLocatorManager.baseAddress.AbsoluteUri }); return(true); } } catch (TimeoutException ex2) { ReplayEventLogConstants.Tuple_ServerLocatorServiceStartTimeout.LogEvent(null, new object[] { ServerLocatorManager.baseAddress.AbsoluteUri, this.GenerateDiagnosticException("Timeout during starting server locator WCF service from ServerLocatorManager.Start()", ex2).Message }); ex = ex2; } if (serviceHostException != null) { ex = serviceHostException; } if (ex != null) { ServerLocatorManager.Tracer.TraceError <string>(0L, "Start() failed to start Server Locator Service communication channel. Error: {0}", ex.Message); } if (this.serviceHost != null) { ServerLocatorManager.Tracer.TraceDebug(0L, "Aborting server locator service communication channel from Start()."); this.serviceHost.Abort(); } ServerLocatorManager.Tracer.TraceError <string, string>(0L, "Failed to start Server Locator Service on {0}. Error: {1}", ServerLocatorManager.baseAddress.AbsoluteUri, ex.Message); ReplayEventLogConstants.Tuple_ServerLocatorServiceFailedToStart.LogEvent(null, new object[] { ServerLocatorManager.baseAddress.AbsoluteUri, ex.Message }); this.m_restartManager.ChangeTimer(ServerLocatorManager.startNowInterval, ServerLocatorManager.restartInterval); result = false; } } finally { if (flag) { object obj; Monitor.Exit(obj); } } return(result); }