internal void Load(XmlElement root) { this.SiloName = root.LocalName.Equals("Override") ? root.GetAttribute("Node") : DEFAULT_NODE_NAME; foreach (XmlNode c in root.ChildNodes) { var child = c as XmlElement; if (child == null) { continue; // Skip comment lines } switch (child.LocalName) { case "Networking": if (child.HasAttribute("Address")) { this.HostNameOrIPAddress = child.GetAttribute("Address"); } if (child.HasAttribute("Port")) { this.Port = ConfigUtilities.ParseInt(child.GetAttribute("Port"), "Non-numeric Port attribute value on Networking element for " + this.SiloName); } if (child.HasAttribute("PreferredFamily")) { this.AddressType = ConfigUtilities.ParseEnum <AddressFamily>(child.GetAttribute("PreferredFamily"), "Invalid preferred address family on Networking node. Valid choices are 'InterNetwork' and 'InterNetworkV6'"); } break; case "ProxyingGateway": this.ProxyGatewayEndpoint = ConfigUtilities.ParseIPEndPoint(child, this.Subnet).GetResult(); break; case "Scheduler": if (child.HasAttribute("MaxActiveThreads")) { this.MaxActiveThreads = ConfigUtilities.ParseInt(child.GetAttribute("MaxActiveThreads"), "Non-numeric MaxActiveThreads attribute value on Scheduler element for " + this.SiloName); if (this.MaxActiveThreads < 1) { this.MaxActiveThreads = SchedulingOptions.DEFAULT_MAX_ACTIVE_THREADS; } } if (child.HasAttribute("DelayWarningThreshold")) { this.DelayWarningThreshold = ConfigUtilities.ParseTimeSpan(child.GetAttribute("DelayWarningThreshold"), "Non-numeric DelayWarningThreshold attribute value on Scheduler element for " + this.SiloName); } if (child.HasAttribute("ActivationSchedulingQuantum")) { this.ActivationSchedulingQuantum = ConfigUtilities.ParseTimeSpan(child.GetAttribute("ActivationSchedulingQuantum"), "Non-numeric ActivationSchedulingQuantum attribute value on Scheduler element for " + this.SiloName); } if (child.HasAttribute("TurnWarningLengthThreshold")) { this.TurnWarningLengthThreshold = ConfigUtilities.ParseTimeSpan(child.GetAttribute("TurnWarningLengthThreshold"), "Non-numeric TurnWarningLengthThreshold attribute value on Scheduler element for " + this.SiloName); } if (child.HasAttribute("MinDotNetThreadPoolSize")) { this.MinDotNetThreadPoolSize = ConfigUtilities.ParseInt(child.GetAttribute("MinDotNetThreadPoolSize"), "Invalid ParseInt MinDotNetThreadPoolSize value on Scheduler element for " + this.SiloName); } if (child.HasAttribute("Expect100Continue")) { this.Expect100Continue = ConfigUtilities.ParseBool(child.GetAttribute("Expect100Continue"), "Invalid ParseBool Expect100Continue value on Scheduler element for " + this.SiloName); } if (child.HasAttribute("DefaultConnectionLimit")) { this.DefaultConnectionLimit = ConfigUtilities.ParseInt(child.GetAttribute("DefaultConnectionLimit"), "Invalid ParseInt DefaultConnectionLimit value on Scheduler element for " + this.SiloName); } if (child.HasAttribute("UseNagleAlgorithm ")) { this.UseNagleAlgorithm = ConfigUtilities.ParseBool(child.GetAttribute("UseNagleAlgorithm "), "Invalid ParseBool UseNagleAlgorithm value on Scheduler element for " + this.SiloName); } break; case "LoadShedding": if (child.HasAttribute("Enabled")) { this.LoadSheddingEnabled = ConfigUtilities.ParseBool(child.GetAttribute("Enabled"), "Invalid boolean value for Enabled attribute on LoadShedding attribute for " + this.SiloName); } if (child.HasAttribute("LoadLimit")) { this.LoadSheddingLimit = ConfigUtilities.ParseInt(child.GetAttribute("LoadLimit"), "Invalid integer value for LoadLimit attribute on LoadShedding attribute for " + this.SiloName); if (this.LoadSheddingLimit < 0) { this.LoadSheddingLimit = 0; } if (this.LoadSheddingLimit > 100) { this.LoadSheddingLimit = 100; } } break; case "Tracing": if (ConfigUtilities.TryParsePropagateActivityId(child, this.siloName, out var propagateActivityId)) { this.PropagateActivityId = propagateActivityId; } break; case "Statistics": ConfigUtilities.ParseStatistics(this, child, this.SiloName); break; case "Limits": ConfigUtilities.ParseLimitValues(this.LimitManager, child, this.SiloName); break; case "Startup": if (child.HasAttribute("Type")) { this.StartupTypeName = child.GetAttribute("Type"); } break; case "Telemetry": ConfigUtilities.ParseTelemetry(child, this.TelemetryConfiguration); break; case "AdditionalAssemblyDirectories": ConfigUtilities.ParseAdditionalAssemblyDirectories(this.AdditionalAssemblyDirectories, child); break; } } }