private void ApplyConfiguration(string configurationName) { WSHttpBindingElement element2 = WSHttpBindingCollectionElement.GetBindingCollectionElement().Bindings[configurationName]; if (element2 == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigInvalidBindingConfigurationName", new object[] { configurationName, "wsHttpBinding" }))); } element2.ApplyConfiguration(this); }
public void WSHttpBinding() { ServiceModelSectionGroup config = (ServiceModelSectionGroup)ConfigurationManager.OpenExeConfiguration("Test/config/wsHttpBinding").GetSectionGroup("system.serviceModel"); WSHttpBindingCollectionElement wsHttpBinding = config.Bindings.WSHttpBinding; Assert.AreEqual(1, wsHttpBinding.Bindings.Count, "count"); WSHttpBindingElement binding = wsHttpBinding.Bindings [0]; Assert.AreEqual("WSHttpBinding_IHelloWorldService", binding.Name, "Name"); Assert.AreEqual(HostNameComparisonMode.StrongWildcard, binding.HostNameComparisonMode, "HostNameComparisonMode"); Assert.AreEqual(SecurityMode.Message, binding.Security.Mode, "Security.Mode"); Assert.AreEqual(MessageCredentialType.Windows, binding.Security.Message.ClientCredentialType, "Security.Message.ClientCredentialType"); Assert.AreEqual(HttpProxyCredentialType.None, binding.Security.Transport.ProxyCredentialType, "Security.Transport.ProtectionLevel"); Assert.AreEqual(HttpClientCredentialType.Windows, binding.Security.Transport.ClientCredentialType, "Security.Transport.ProtectionLevel"); }
void ApplyConfiguration(string configurationName) { WSHttpBindingCollectionElement section = WSHttpBindingCollectionElement.GetBindingCollectionElement(); WSHttpBindingElement element = section.Bindings[configurationName]; if (element == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException( SR.GetString(SR.ConfigInvalidBindingConfigurationName, configurationName, ConfigurationStrings.WSHttpBindingCollectionElementName))); } else { element.ApplyConfiguration(this); } }