示例#1
0
        /// <summary>
        /// Checks the specified configuration manager.
        /// </summary>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <returns></returns>
        public override ProblemCollection Check(ServiceModelConfigurationManager configurationManager)
        {
            // Check for service endpoints
            foreach (ServiceElement serviceElement in configurationManager.GetServices())
            {
                foreach (ServiceEndpointElement endpointElement in serviceElement.Endpoints)
                {
                    if (endpointElement.Binding.Equals(CustomBindingAttributeValue, StringComparison.InvariantCultureIgnoreCase))
                    {
                        CheckRuleForCustomBinding(configurationManager.GetCustomBinding(endpointElement.BindingConfiguration));
                    }
                }
            }
            // Check for client endponts
            ClientSection client = configurationManager.ServiceModelSection.Client;

            if (client != null)
            {
                foreach (ChannelEndpointElement clientEndpoint in client.Endpoints)
                {
                    if (clientEndpoint.Binding.Equals(CustomBindingAttributeValue, StringComparison.InvariantCultureIgnoreCase))
                    {
                        CheckRuleForCustomBinding(configurationManager.GetCustomBinding(clientEndpoint.BindingConfiguration));
                    }
                }
            }
            return(base.Problems);
        }
        /// <summary>
        /// Checks the specified configuration manager.
        /// </summary>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <returns></returns>
        public override ProblemCollection Check(ServiceModelConfigurationManager configurationManager)
        {
            foreach (ServiceBehaviorElement behaviorElement in configurationManager.ServiceModelSection.Behaviors.ServiceBehaviors)
            {
                ServiceDebugElement serviceDebug =
                    ServiceModelConfigurationManager.GetBehaviorExtensionElement <ServiceDebugElement>(behaviorElement);

                if (serviceDebug.IncludeExceptionDetailInFaults)
                {
                    Resolution resolution = base.GetResolution(behaviorElement.Name);
                    Problem    problem    = new Problem(resolution);
                    problem.SourceFile = base.SourceFile;
                    base.Problems.Add(problem);
                }
            }
            return(base.Problems);
        }
        /// <summary>
        /// Checks the specified configuration manager.
        /// </summary>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <returns></returns>
        public override ProblemCollection Check(ServiceModelConfigurationManager configurationManager)
        {
            foreach (EndpointBehaviorElement behaviorElement in configurationManager.ServiceModelSection.Behaviors.EndpointBehaviors)
            {
                ClientCredentialsElement clientCredentials =
                    ServiceModelConfigurationManager.GetBehaviorExtensionElement <ClientCredentialsElement>(behaviorElement);

                X509RevocationMode revocationMode = clientCredentials.ServiceCertificate.Authentication.RevocationMode;

                if (revocationMode == X509RevocationMode.NoCheck)
                {
                    Resolution resolution = base.GetResolution(revocationMode.ToString());
                    Problem    problem    = new Problem(resolution);
                    problem.SourceFile = base.SourceFile;
                    base.Problems.Add(problem);
                }
            }
            return(base.Problems);
        }
        /// <summary>
        /// Checks the specified configuration manager.
        /// </summary>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <returns></returns>
        public override ProblemCollection Check(ServiceModelConfigurationManager configurationManager)
        {
            foreach (ServiceBehaviorElement behaviorElement in configurationManager.ServiceModelSection.Behaviors.ServiceBehaviors)
            {
                ServiceCredentialsElement serviceCredentials =
                    ServiceModelConfigurationManager.GetBehaviorExtensionElement <ServiceCredentialsElement>(behaviorElement);

                X509CertificateValidationMode validationMode = serviceCredentials.ClientCertificate.Authentication.CertificateValidationMode;

                if (validationMode != X509CertificateValidationMode.ChainTrust)
                {
                    Resolution resolution = base.GetResolution(validationMode.ToString(),
                                                               X509CertificateValidationMode.ChainTrust.ToString());
                    Problem problem = new Problem(resolution);
                    problem.SourceFile = base.SourceFile;
                    base.Problems.Add(problem);
                }
            }
            return(base.Problems);
        }
 /// <summary>
 /// Checks the specified configuration manager.
 /// </summary>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <returns></returns>
 public abstract ProblemCollection Check(ServiceModelConfigurationManager configurationManager);