protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { // It seems to do nothing. }
protected override void OnInitializeAndValidate(ServiceEndpointElement channelEndpointElement) { // It seems to do nothing. base.OnInitializeAndValidate(channelEndpointElement); }
// Read the value given to the property in config and save it protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { CustomEndpoint customEndpoint = (CustomEndpoint)endpoint; customEndpoint.Property = this.Property; }
private static ServiceEndpoint CreateServiceEndpoint(Type serviceType, ServiceEndpointElement item) { throw new NotImplementedException(); }
private void CreateMetadataBehavior(SpringServiceHost ssh, ServiceMetadataBehavior smb, ServiceEndpointElement metadataEle) { if (smb == null) { smb = new ServiceMetadataBehavior(); if (ssh.BaseAddresses.Any(o => o.Scheme.ToLower() == Uri.UriSchemeHttp)) { smb.HttpGetEnabled = true; } ssh.Description.Behaviors.Add(smb); } foreach (var baseAddress in ssh.BaseAddresses) { //BindingElement bindingElement = null; Binding bindingElement = null; switch (baseAddress.Scheme) { case "net.tcp": { bindingElement = MetadataExchangeBindings.CreateMexTcpBinding(); //bindingElement = new TcpTransportBindingElement(); break; } case "net.pipe": { bindingElement = MetadataExchangeBindings.CreateMexNamedPipeBinding(); //bindingElement = new NamedPipeTransportBindingElement(); break; } case "http": { bindingElement = MetadataExchangeBindings.CreateMexHttpBinding(); //bindingElement = new HttpTransportBindingElement(); break; } case "https": { bindingElement = MetadataExchangeBindings.CreateMexHttpsBinding(); //bindingElement = new HttpsTransportBindingElement(); break; } default: throw new ProtocolException("The base address {0} Unable to identify".FormatString(baseAddress.ToString())); } if (bindingElement != null) { //Binding binding = new CustomBinding(bindingElement); ssh.AddServiceEndpoint(typeof(IMetadataExchange), bindingElement, "MEX"); } } }
/// <summary> /// 根据WCF元数据创建SpringServiceHost列表 /// <code> /// WCFService wcfservice = new WCFService(); /// _container.Add(wm, wcfservice.Builder(wm)); /// </code> /// </summary> /// <param name="serviceMeta">WCF元数据</param> /// <returns>SpringServiceHost列表</returns> public List <SpringServiceHost> Builder(WCFServiceMeta serviceMeta) { WCFServiceMeta = serviceMeta; List <SpringServiceHost> ssh = new List <SpringServiceHost>(); ServiceEndpointElement metaServiceEndpoint = null; try { foreach (ServiceElement service in serviceMeta.ServicesConfiguration.Services) { List <Uri> baseUris = new List <Uri>(); foreach (BaseAddressElement ba in service.Host.BaseAddresses) { baseUris.Add(new Uri(ba.BaseAddress)); } //ServiceHost sh = new System.ServiceModel.ServiceHost(CreateContactType(service.Name), baseUris.ToArray()); //IApplicationContext c = ContextRegistry.GetContext(serviceMeta.ContextName); SpringWebServiceHost sh2 = null; SpringServiceHost sh = null;// new SpringServiceHost(service.Name, serviceMeta.ContextName, baseUris.ToArray()); // SpringWebServiceHost sh = new WebServiceHost() foreach (ServiceEndpointElement see in service.Endpoints) { Type contactType; if (see.Contract == "IMetadataExchange") { //contactType = typeof(IMetadataExchange); metaServiceEndpoint = see; continue; } else { contactType = CreateContactType(see.Contract); } //ContractDescription cd = ContractDescription.GetContract(contactType); Binding binding = WCFMateHelper.BindingFactory(serviceMeta, see); if (binding is WebHttpBinding) { sh2 = new SpringWebServiceHost(service.Name, serviceMeta.ContextName, baseUris.ToArray()); sh2.AddServiceEndpoint(contactType, binding, see.Address); } else { try { sh = new SpringServiceHost(service.Name, serviceMeta.ContextName, baseUris.ToArray()); sh.AddServiceEndpoint(contactType, binding, see.Address); }catch (Exception ex) { throw new Exception(string.Format("创建服务失败,WCF配置中的服务名称{0},不能在容器中获取实例", service.Name), ex.InnerException); } } } try { if (sh2 == null) { ServiceDebugBehavior sdb = sh.Description.Behaviors.Find <ServiceDebugBehavior>(); { if (sdb != null) { sdb.IncludeExceptionDetailInFaults = true; } else { ServiceDebugBehavior sb = new ServiceDebugBehavior(); sb.IncludeExceptionDetailInFaults = true; sh.Description.Behaviors.Add(sb); } } ServiceMetadataBehavior behavior = sh.Description.Behaviors.Find <ServiceMetadataBehavior>(); { CreateMetadataBehavior(sh, behavior, metaServiceEndpoint); } WCFMateHelper.BuildingServiceaBehavior(serviceMeta, service, sh); sh.Faulted += sh_Faulted; sh.UnknownMessageReceived += sh_UnknownMessageReceived; if (sh.State != CommunicationState.Opened) { sh.Open(); } ssh.Add(sh); } else { ServiceDebugBehavior sdb = sh2.Description.Behaviors.Find <ServiceDebugBehavior>(); { if (sdb != null) { sdb.IncludeExceptionDetailInFaults = true; } else { ServiceDebugBehavior sb = new ServiceDebugBehavior(); sb.IncludeExceptionDetailInFaults = true; sh2.Description.Behaviors.Add(sb); } } sh2.Faulted += sh_Faulted; sh2.UnknownMessageReceived += sh_UnknownMessageReceived; if (sh2.State != CommunicationState.Opened) { sh2.Open(); } } } catch (Exception ex) { throw new WCFServiceCreateException(Resources.WCFServiceCreateException, ex); } } } catch (Exception serException) { throw serException; } return(ssh); }
protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { throw new NotImplementedException(); }
public CodeGenerationResults Generate(IArtifactLink link) { CodeGenerationResults result = new CodeGenerationResults(); string serviceImplementationName = string.Empty; string serviceContractName = string.Empty; string serviceNamespace = string.Empty; const string behavior = "_Behavior"; if (link is IModelReference) { this.serviceProvider = Utility.GetData <IServiceProvider>(link); ProjectNode project = Utility.GetData <ProjectNode>(link); ServiceDescription serviceDescription = ((IModelReference)link).ModelElement as ServiceDescription; Configuration configuration = GetConfiguration(link, project); // abort if we got errors in config file if (configuration == null) { return(result); } try { ServiceReference serviceReference = (ServiceReference)serviceDescription; SCModel.Service service = GetMelReference <SCModel.Service>(serviceReference.ServiceImplementationType); serviceImplementationName = ResolveTypeReference(service); serviceContractName = GetServiceContractName(service.ServiceContract); serviceNamespace = service.ServiceContract.Namespace; ServiceModelConfigurationManager manager = new ServiceModelConfigurationManager(configuration); ServiceElement serviceElement = new ServiceElement(); serviceElement.Name = serviceImplementationName; serviceElement.BehaviorConfiguration = string.Concat(serviceImplementationName, behavior); foreach (Endpoint endpoint in serviceDescription.Endpoints) { ServiceEndpointElement endpointElement = new ServiceEndpointElement(); endpointElement.Name = endpoint.Name; endpointElement.Contract = serviceContractName; endpointElement.Binding = ((WcfEndpoint)endpoint.ObjectExtender).BindingType.ToString(); endpointElement.Address = new Uri(endpoint.Address ?? string.Empty, UriKind.RelativeOrAbsolute); endpointElement.BindingNamespace = serviceNamespace; serviceElement.Endpoints.Add(endpointElement); } manager.UpdateService(serviceElement); ServiceBehaviorElement behaviorElement = new ServiceBehaviorElement(); behaviorElement.Name = string.Concat(serviceImplementationName, behavior); ServiceDebugElement debugElement = new ServiceDebugElement(); debugElement.IncludeExceptionDetailInFaults = false; behaviorElement.Add(debugElement); if (((WcfServiceDescription)serviceDescription.ObjectExtender).EnableMetadataPublishing) { ServiceMetadataPublishingElement metadataPublishingElement = new ServiceMetadataPublishingElement(); metadataPublishingElement.HttpGetEnabled = true; behaviorElement.Add(metadataPublishingElement); ServiceEndpointElement mexEndpointElement = ServiceModelConfigurationManager.GetMetadataExchangeEndpoint(); serviceElement.Endpoints.Add(mexEndpointElement); } manager.UpdateBehavior(behaviorElement); manager.Save(); result.Add(link.ItemPath, File.ReadAllText(configuration.FilePath)); } finally { if (configuration != null && File.Exists(configuration.FilePath)) { File.Delete(configuration.FilePath); } } } return(result); }
/// <summary> /// Enregistre une instance de service. /// </summary> /// <param name="contractType">Type de l'interface représentant le contrat.</param> /// <param name="serviceType">Type du service.</param> public void RegisterLocalService(Type contractType, Type serviceType) { if (contractType == null) { throw new ArgumentNullException("contractType"); } if (serviceType == null) { throw new ArgumentNullException("serviceType"); } if (!contractType.IsInterface) { throw new ArgumentException("contractType " + contractType.FullName + "must define an interface."); } if (!contractType.IsAssignableFrom(serviceType)) { throw new ArgumentException("Invalid serviceType " + serviceType.FullName); } if (_localServices.Contains(contractType)) { throw new NotSupportedException("Contract already registered for contractType " + contractType.FullName); } ILog log = LogManager.GetLogger("Kinetix.Application"); if (log.IsDebugEnabled) { log.Debug("Enregistrement du service " + contractType.FullName); } List <Accessor> referenceAccessors = new List <Accessor>(); List <Accessor> primaryKeyAccessors = new List <Accessor>(); List <Accessor> autoCompleteAccessors = new List <Accessor>(); List <Accessor> fileAccessors = new List <Accessor>(); List <string> disableLogList = new List <string>(); ParseAccessors(contractType, referenceAccessors, primaryKeyAccessors, autoCompleteAccessors, fileAccessors, disableLogList); if (!HasWcfClientEndPoint(contractType) || HttpContext.Current == null) { ServiceEndpointElement sep = HasWcfServerEndPoint(serviceType, contractType); if (sep != null && HttpContext.Current == null && !DisableServiceHosts) { if (log.IsInfoEnabled) { log.Info("Inscription du service " + sep.Contract + " à l'adresse " + sep.Address + "."); } _container.RegisterType( serviceType, new Interceptor <InterfaceInterceptor>(), new InterceptionBehavior <LogInterceptionBehavior>()); UnityServiceHost host = new UnityServiceHost(serviceType); host.Container = _container; host.Open(); _hostList.Add(host); } else { InterceptionPipelineEventArgs args = new InterceptionPipelineEventArgs(contractType, new List <InjectionMember> { new Interceptor <InterfaceInterceptor>(), //// new InterceptionBehavior<HighAvailabilityInterceptionBehavior>(), new InterceptionBehavior <LogInterceptionBehavior>(), new InterceptionBehavior <TransactionInterceptionBehavior>(), new InterceptionBehavior <AnalyticsInterceptionBehavior>() }); if (this.RegisteringInterceptors != null) { this.RegisteringInterceptors(this, args); } _container.RegisterType( contractType, serviceType, args.Interceptors.ToArray()); _localServices.Add(contractType); } } this.RegisterReferenceAccessors(referenceAccessors); this.RegisterPrimaryKeyAccessors(primaryKeyAccessors); this.RegisterAutoCompleteAccessors(autoCompleteAccessors); this.RegisterFileAccessors(fileAccessors); }
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { throw FxTrace.Exception.AsError( new InvalidOperationException( SR.DiscoveryConfigDynamicEndpointInService(serviceEndpointElement.Kind))); }
/// <summary> /// When called from a derived class, loads the service description information /// from the configuration file and applies it to the runtime being constructed. /// </summary> /// <param name="endpoint">And endpoint that enables clients to find and communicate with a service.</param> /// <param name="serviceEndpointElement">A service endpoint element of a service application.</param> protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { this.InternalOnApplyConfiguration(endpoint); }
// This method adds automatic endpoints at the base addresses, 1 per site binding (http or https). It only configures // the security on the binding. It does not add any behaviors. // If there are no base addresses, or if endpoints have been configured explicitly, it does not add any // automatic endpoints. // If it adds automatic endpoints, it validates that the service implements a single contract internal static void AddAutomaticWebHttpBindingEndpoints(ServiceHost host, IDictionary <string, ContractDescription> implementedContracts, string multipleContractsErrorMessage, string noContractErrorMessage, string standardEndpointKind) { bool enableAutoEndpointCompat = AppSettings.EnableAutomaticEndpointsCompatibility; // We do not add an automatic endpoint if an explicit endpoint has been configured unless // the user has specifically opted into compat mode. See CSDMain bugs 176157 & 262728 for history if (host.Description.Endpoints != null && host.Description.Endpoints.Count > 0 && !enableAutoEndpointCompat) { return; } AuthenticationSchemes supportedSchemes = AuthenticationSchemes.None; if (host.BaseAddresses.Count > 0) { supportedSchemes = AspNetEnvironment.Current.GetAuthenticationSchemes(host.BaseAddresses[0]); if (AspNetEnvironment.Current.IsSimpleApplicationHost) { // Cassini always reports the auth scheme as anonymous or Ntlm. Map this to Ntlm, except when forms auth // is requested if (supportedSchemes == (AuthenticationSchemes.Anonymous | AuthenticationSchemes.Ntlm)) { if (AspNetEnvironment.Current.IsWindowsAuthenticationConfigured()) { supportedSchemes = AuthenticationSchemes.Ntlm; } else { supportedSchemes = AuthenticationSchemes.Anonymous; } } } } Type contractType = null; // add an endpoint with the contract at each base address foreach (Uri baseAddress in host.BaseAddresses) { string uriScheme = baseAddress.Scheme; // HTTP and HTTPs are only supported schemes if (Object.ReferenceEquals(uriScheme, Uri.UriSchemeHttp) || Object.ReferenceEquals(uriScheme, Uri.UriSchemeHttps)) { // bypass adding the automatic endpoint if there's already one at the base address bool isExplicitEndpointConfigured = false; foreach (ServiceEndpoint endpoint in host.Description.Endpoints) { if (endpoint.Address != null && EndpointAddress.UriEquals(endpoint.Address.Uri, baseAddress, true, false)) { isExplicitEndpointConfigured = true; break; } } if (isExplicitEndpointConfigured) { continue; } if (contractType == null) { if (implementedContracts.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(multipleContractsErrorMessage)); } else if (implementedContracts.Count == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(noContractErrorMessage)); } foreach (ContractDescription contract in implementedContracts.Values) { contractType = contract.ContractType; break; } } // Get the default web endpoint ConfigLoader configLoader = new ConfigLoader(host.GetContractResolver(implementedContracts)); ServiceEndpointElement serviceEndpointElement = new ServiceEndpointElement(); serviceEndpointElement.Contract = contractType.FullName; // Check for a protocol mapping ProtocolMappingItem protocolMappingItem = ConfigLoader.LookupProtocolMapping(baseAddress.Scheme); if (protocolMappingItem != null && string.Equals(protocolMappingItem.Binding, WebHttpBinding.WebHttpBindingConfigurationStrings.WebHttpBindingCollectionElementName, StringComparison.Ordinal)) { serviceEndpointElement.BindingConfiguration = protocolMappingItem.BindingConfiguration; } serviceEndpointElement.Kind = standardEndpointKind; // LookupEndpoint will not set the Endpoint address and listenUri // because omitSettingEndpointAddress is set to true. // We will set them after setting the binding security ServiceEndpoint automaticEndpoint = configLoader.LookupEndpoint(serviceEndpointElement, null, host, host.Description, true /*omitSettingEndpointAddress*/); WebHttpBinding binding = automaticEndpoint.Binding as WebHttpBinding; bool automaticallyConfigureSecurity = !binding.Security.IsModeSet; if (automaticallyConfigureSecurity) { if (Object.ReferenceEquals(uriScheme, Uri.UriSchemeHttps)) { binding.Security.Mode = WebHttpSecurityMode.Transport; } else if (supportedSchemes != AuthenticationSchemes.None && supportedSchemes != AuthenticationSchemes.Anonymous) { binding.Security.Mode = WebHttpSecurityMode.TransportCredentialOnly; } else { binding.Security.Mode = WebHttpSecurityMode.None; } } if (automaticallyConfigureSecurity && AspNetEnvironment.Enabled) { SetBindingCredentialBasedOnHostedEnvironment(automaticEndpoint, supportedSchemes); } // Setting the Endpoint address and listenUri now that we've set the binding security ConfigLoader.ConfigureEndpointAddress(serviceEndpointElement, host, automaticEndpoint); ConfigLoader.ConfigureEndpointListenUri(serviceEndpointElement, host, automaticEndpoint); host.AddServiceEndpoint(automaticEndpoint); } } }
/// <summary> /// 生成Binding对象 /// <code> /// WCFMateHelper.BindingFactory(serviceMeta,see) /// </code> /// </summary> /// <param name="wCFServiceMeta"></param> /// <param name="serviceEndpoint"></param> /// <returns></returns> public static Binding BindingFactory(WCFServiceMeta wCFServiceMeta, ServiceEndpointElement serviceEndpoint) { BindingsSection bindings = wCFServiceMeta.ChildConfiguration.GetSection("system.serviceModel/bindings") as BindingsSection; BindingCollectionElement bc = bindings[serviceEndpoint.Binding]; switch (bc.BindingName.ToLower()) { case "nettcpbinding": { NetTcpBinding ntb = new NetTcpBinding(); NetTcpBindingElement bce = bc.ConfiguredBindings.FirstOrDefault(o => o.Name == serviceEndpoint.BindingConfiguration) as NetTcpBindingElement; if (bce != null) { ntb.CloseTimeout = bce.CloseTimeout; ntb.OpenTimeout = bce.OpenTimeout; ntb.ReceiveTimeout = bce.ReceiveTimeout; ntb.SendTimeout = bce.SendTimeout; ntb.MaxBufferPoolSize = bce.MaxBufferPoolSize; ntb.HostNameComparisonMode = bce.HostNameComparisonMode; ntb.ListenBacklog = (bce.ListenBacklog != 0 ? bce.ListenBacklog : ntb.ListenBacklog); ntb.MaxBufferSize = bce.MaxBufferSize; ntb.MaxConnections = (bce.MaxConnections == 0 ? ntb.MaxConnections : bce.MaxConnections); ntb.MaxReceivedMessageSize = bce.MaxReceivedMessageSize; ntb.PortSharingEnabled = bce.PortSharingEnabled; ntb.ReaderQuotas.MaxArrayLength = (bce.ReaderQuotas.MaxArrayLength != 0 ? bce.ReaderQuotas.MaxArrayLength : ntb.ReaderQuotas.MaxArrayLength); ntb.ReaderQuotas.MaxDepth = (bce.ReaderQuotas.MaxDepth != 0 ? bce.ReaderQuotas.MaxDepth : ntb.ReaderQuotas.MaxDepth); ntb.ReaderQuotas.MaxBytesPerRead = (bce.ReaderQuotas.MaxBytesPerRead != 0 ? bce.ReaderQuotas.MaxBytesPerRead : ntb.ReaderQuotas.MaxBytesPerRead); ntb.ReaderQuotas.MaxNameTableCharCount = (bce.ReaderQuotas.MaxNameTableCharCount != 0 ? bce.ReaderQuotas.MaxNameTableCharCount : ntb.ReaderQuotas.MaxNameTableCharCount); ntb.ReaderQuotas.MaxStringContentLength = (bce.ReaderQuotas.MaxStringContentLength != 0 ? bce.ReaderQuotas.MaxStringContentLength : ntb.ReaderQuotas.MaxStringContentLength); ntb.ReliableSession = new OptionalReliableSession() { Enabled = bce.ReliableSession.Enabled, InactivityTimeout = bce.ReliableSession.InactivityTimeout, Ordered = bce.ReliableSession.Ordered }; ntb.Security = new NetTcpSecurity() { Mode = SecurityMode.None }; ntb.TransactionFlow = bce.TransactionFlow; ntb.TransactionProtocol = bce.TransactionProtocol; ntb.TransferMode = bce.TransferMode; } return(ntb); } case "basichttpbinding": { BasicHttpBinding bhb = new BasicHttpBinding(BasicHttpSecurityMode.None); BasicHttpBindingElement bce = bc.ConfiguredBindings.FirstOrDefault(o => o.Name == serviceEndpoint.BindingConfiguration) as BasicHttpBindingElement; if (bce != null) { bhb.AllowCookies = bce.AllowCookies; bhb.BypassProxyOnLocal = bce.BypassProxyOnLocal; bhb.CloseTimeout = bce.CloseTimeout; bhb.HostNameComparisonMode = bce.HostNameComparisonMode; bhb.MaxBufferPoolSize = bce.MaxBufferPoolSize; bhb.MaxBufferSize = bce.MaxBufferSize; bhb.MaxReceivedMessageSize = bce.MaxReceivedMessageSize; bhb.MessageEncoding = bce.MessageEncoding; bhb.OpenTimeout = bce.OpenTimeout; bhb.ProxyAddress = bce.ProxyAddress; bhb.ReaderQuotas.MaxArrayLength = (bce.ReaderQuotas.MaxArrayLength != 0 ? bce.ReaderQuotas.MaxArrayLength : bhb.ReaderQuotas.MaxArrayLength); bhb.ReaderQuotas.MaxDepth = (bce.ReaderQuotas.MaxDepth != 0 ? bce.ReaderQuotas.MaxDepth : bhb.ReaderQuotas.MaxDepth); bhb.ReaderQuotas.MaxBytesPerRead = (bce.ReaderQuotas.MaxBytesPerRead != 0 ? bce.ReaderQuotas.MaxBytesPerRead : bhb.ReaderQuotas.MaxBytesPerRead); bhb.ReaderQuotas.MaxNameTableCharCount = (bce.ReaderQuotas.MaxNameTableCharCount != 0 ? bce.ReaderQuotas.MaxNameTableCharCount : bhb.ReaderQuotas.MaxNameTableCharCount); bhb.ReaderQuotas.MaxStringContentLength = (bce.ReaderQuotas.MaxStringContentLength != 0 ? bce.ReaderQuotas.MaxStringContentLength : bhb.ReaderQuotas.MaxStringContentLength); bhb.ReceiveTimeout = bce.ReceiveTimeout; bhb.SendTimeout = bce.SendTimeout; bhb.TextEncoding = bce.TextEncoding; bhb.TransferMode = bce.TransferMode; bhb.UseDefaultWebProxy = bce.UseDefaultWebProxy; } return(bhb); } case "webhttpbinding": { WebHttpBinding bhb = new WebHttpBinding(WebHttpSecurityMode.None); bhb.CrossDomainScriptAccessEnabled = true; WebHttpBindingElement bce = bc.ConfiguredBindings.FirstOrDefault(o => o.Name == serviceEndpoint.BindingConfiguration) as WebHttpBindingElement; if (bce != null) { bhb.AllowCookies = bce.AllowCookies; bhb.BypassProxyOnLocal = bce.BypassProxyOnLocal; bhb.CloseTimeout = bce.CloseTimeout; bhb.HostNameComparisonMode = bce.HostNameComparisonMode; bhb.MaxBufferPoolSize = bce.MaxBufferPoolSize; bhb.MaxBufferSize = bce.MaxBufferSize; bhb.MaxReceivedMessageSize = bce.MaxReceivedMessageSize; //bhb.MessageVersion = bce.m.MessageEncoding; bhb.OpenTimeout = bce.OpenTimeout; bhb.ProxyAddress = bce.ProxyAddress; bhb.ReaderQuotas.MaxArrayLength = (bce.ReaderQuotas.MaxArrayLength != 0 ? bce.ReaderQuotas.MaxArrayLength : bhb.ReaderQuotas.MaxArrayLength); bhb.ReaderQuotas.MaxDepth = (bce.ReaderQuotas.MaxDepth != 0 ? bce.ReaderQuotas.MaxDepth : bhb.ReaderQuotas.MaxDepth); bhb.ReaderQuotas.MaxBytesPerRead = (bce.ReaderQuotas.MaxBytesPerRead != 0 ? bce.ReaderQuotas.MaxBytesPerRead : bhb.ReaderQuotas.MaxBytesPerRead); bhb.ReaderQuotas.MaxNameTableCharCount = (bce.ReaderQuotas.MaxNameTableCharCount != 0 ? bce.ReaderQuotas.MaxNameTableCharCount : bhb.ReaderQuotas.MaxNameTableCharCount); bhb.ReaderQuotas.MaxStringContentLength = (bce.ReaderQuotas.MaxStringContentLength != 0 ? bce.ReaderQuotas.MaxStringContentLength : bhb.ReaderQuotas.MaxStringContentLength); bhb.ReceiveTimeout = bce.ReceiveTimeout; bhb.SendTimeout = bce.SendTimeout; bhb.Name = bce.Name; bhb.TransferMode = bce.TransferMode; bhb.UseDefaultWebProxy = bce.UseDefaultWebProxy; } return(bhb); } case "wshttpbinding": { WSHttpBinding bhb = new WSHttpBinding(SecurityMode.None); WSHttpBindingElement bce = bc.ConfiguredBindings.FirstOrDefault(o => o.Name == serviceEndpoint.BindingConfiguration) as WSHttpBindingElement; if (bce != null) { bhb.AllowCookies = bce.AllowCookies; bhb.BypassProxyOnLocal = bce.BypassProxyOnLocal; bhb.CloseTimeout = bce.CloseTimeout; bhb.HostNameComparisonMode = bce.HostNameComparisonMode; bhb.MaxBufferPoolSize = bce.MaxBufferPoolSize; bhb.MaxReceivedMessageSize = bce.MaxReceivedMessageSize; bhb.MessageEncoding = bce.MessageEncoding; bhb.OpenTimeout = bce.OpenTimeout; bhb.ProxyAddress = bce.ProxyAddress; bhb.ReaderQuotas.MaxArrayLength = (bce.ReaderQuotas.MaxArrayLength != 0 ? bce.ReaderQuotas.MaxArrayLength : bhb.ReaderQuotas.MaxArrayLength); bhb.ReaderQuotas.MaxDepth = (bce.ReaderQuotas.MaxDepth != 0 ? bce.ReaderQuotas.MaxDepth : bhb.ReaderQuotas.MaxDepth); bhb.ReaderQuotas.MaxBytesPerRead = (bce.ReaderQuotas.MaxBytesPerRead != 0 ? bce.ReaderQuotas.MaxBytesPerRead : bhb.ReaderQuotas.MaxBytesPerRead); bhb.ReaderQuotas.MaxNameTableCharCount = (bce.ReaderQuotas.MaxNameTableCharCount != 0 ? bce.ReaderQuotas.MaxNameTableCharCount : bhb.ReaderQuotas.MaxNameTableCharCount); bhb.ReaderQuotas.MaxStringContentLength = (bce.ReaderQuotas.MaxStringContentLength != 0 ? bce.ReaderQuotas.MaxStringContentLength : bhb.ReaderQuotas.MaxStringContentLength); bhb.ReceiveTimeout = bce.ReceiveTimeout; bhb.SendTimeout = bce.SendTimeout; bhb.TextEncoding = bce.TextEncoding; bhb.TransactionFlow = bce.TransactionFlow; bhb.UseDefaultWebProxy = bce.UseDefaultWebProxy; } return(bhb); } } throw new BindingNotFoundException(Resources.BindingNotFoundException); }
protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { }
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { // There seems nothing to do here. }
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { }
public static EndpointAddress CreateEndpointAddress(this ServiceEndpointElement el) { return(new EndpointAddress(el.Address, el.Identity != null ? el.Identity.CreateInstance() : null, el.Headers.Headers)); }