public ServicePropertiesModel(ServiceHostBase serviceHost)
            {
                if (serviceHost == null)
                {
                    throw new ArgumentNullException(nameof(serviceHost));
                }

                this.Name            = ServiceHealthBehavior.GetServiceName(serviceHost);
                this.State           = serviceHost.State;
                this.ServiceTypeName = serviceHost.Description?.ServiceType?.FullName;

                ServiceBehaviorAttribute serviceBehavior = serviceHost.Description?.Behaviors.Find <ServiceBehaviorAttribute>();

                if (serviceBehavior != null)
                {
                    this.InstanceContextMode = serviceBehavior.InstanceContextMode;
                    this.ConcurrencyMode     = serviceBehavior.ConcurrencyMode;
                }

                this.ServiceBehaviorNames = GetServiceBehaviorNames(serviceHost);
                this.ServiceThrottle      = new ServiceThrottleModel(serviceHost.ServiceThrottle);
                this.BaseAddresses        = GetBaseAddresses(serviceHost);
            }
        public override void HandleHealthRequest(ServiceHostBase serviceHost, Message httpGetRequest, string[] queries, out Message replyMessage)
        {
            const string noContentStr = "noContent";
            const string xmlStr       = "xml";

            if (serviceHost == null)
            {
                throw new ArgumentNullException(nameof(serviceHost));
            }

            if (httpGetRequest == null)
            {
                throw new ArgumentNullException(nameof(httpGetRequest));
            }

            if (queries == null)
            {
                throw new ArgumentNullException(nameof(queries));
            }

            replyMessage = null;

            bool isXml     = false;
            bool noContent = false;
            bool result;

            foreach (string q in queries)
            {
                if (TryParseBooleanQueryParameter(noContentStr, q, true, out result))
                {
                    noContent = result;
                }
                else if (TryParseBooleanQueryParameter(xmlStr, q, true, out result))
                {
                    isXml = result;
                }
            }

            HttpStatusCode httpStatusCode = GetHttpResponseCode(serviceHost, queries);

            if (this.HealthDetailsEnabled && !noContent)
            {
                if (isXml && HasXmlSupport)
                {
                    XmlDocument doc = GetXmlDocument(serviceHost);
                    if (doc != null)
                    {
                        replyMessage = new XmlDocumentMessage(doc);
                    }
                }
                else
                {
                    ServiceHealthSectionCollection healthInfo = GetServiceHealthSections(serviceHost);

                    if (healthInfo != null && healthInfo.Count > 0)
                    {
                        string name = ServiceHealthBehavior.GetServiceName(serviceHost);
                        replyMessage = new ServiceHealthMessage(healthInfo, name, (int)httpStatusCode);
                    }
                }
            }

            if (replyMessage == null)
            {
                replyMessage = new EmptyMessage();
            }

            AddHttpProperty(replyMessage, httpStatusCode, isXml);
        }