protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { if (serviceEndpointElement.Address == null) { serviceEndpointElement.Address = this.Address; } }
public void InitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { if (serviceEndpointElement == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("serviceEndpointElement"); } this.OnInitializeAndValidate(serviceEndpointElement); }
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { if (String.IsNullOrEmpty(serviceEndpointElement.Binding)) { serviceEndpointElement.Binding = ConfigurationStrings.MexHttpBindingCollectionElementName; } serviceEndpointElement.Contract = ServiceMetadataBehavior.MexContractName; serviceEndpointElement.IsSystemEndpoint = true; }
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { if (string.IsNullOrEmpty(serviceEndpointElement.Binding)) { serviceEndpointElement.Binding = "mexHttpBinding"; } serviceEndpointElement.Contract = "IMetadataExchange"; serviceEndpointElement.IsSystemEndpoint = true; }
public void InitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { if (null == serviceEndpointElement) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("serviceEndpointElement"); } // The properties serviceEndpointElement.Name and this.Name are actually two different things: // - serviceEndpointElement.Name corresponds to the service endpoint name // - this.Name is a token used as a key in the endpoint collection to identify // a specific bucket of configuration settings. // Thus, the Name property is skipped here. this.OnInitializeAndValidate(serviceEndpointElement); }
public void ApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { if (endpoint == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpoint"); } if (serviceEndpointElement == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("serviceEndpointElement"); } if (endpoint.GetType() != this.EndpointType) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.ServiceModel.SR.GetString("ConfigInvalidTypeForEndpoint", new object[] { (this.EndpointType == null) ? string.Empty : this.EndpointType.AssemblyQualifiedName, endpoint.GetType().AssemblyQualifiedName })); } this.OnApplyConfiguration(endpoint, serviceEndpointElement); }
static ServiceEndpoint CreateServiceEndpoint(Type serviceType, ServiceEndpointElement endpointElement) { //创建ServiceEndpoint EndpointAddress address = new EndpointAddress(endpointElement.Address); Binding binding = ConfigLoader.CreateBinding(endpointElement.Binding); ContractDescription contract = CreateContractDescription(serviceType, endpointElement.Contract); ServiceEndpoint endpoint = new ServiceEndpoint(contract, binding, address); //添加终结点行为 if (!string.IsNullOrEmpty(endpointElement.BehaviorConfiguration)) { EndpointBehaviorElement behaviorElement = ConfigLoader.GetEndpointBehaviorElement(endpointElement.BehaviorConfiguration); foreach (BehaviorExtensionElement extensionElement in behaviorElement) { IEndpointBehavior endpointBehavior = (IEndpointBehavior)extensionElement.CreateBehavior(); endpoint.Behaviors.Add(endpointBehavior); } } return endpoint; }
public ServiceEndpoint GenerateServiceEndpoint(ServiceHostBase serviceHost, Uri baseAddress) { Fx.Assert(serviceHost != null, "The 'serviceHost' parameter should not be null."); Fx.Assert(baseAddress != null, "The 'baseAddress' parameter should not be null."); AuthenticationSchemes supportedSchemes = GetAuthenticationSchemes(baseAddress); Type contractType = this.GetSingleImplementedContract(); ConfigLoader configLoader = new ConfigLoader(serviceHost.GetContractResolver(this.implementedContracts)); ServiceEndpointElement serviceEndpointElement = new ServiceEndpointElement(); serviceEndpointElement.Contract = contractType.FullName; this.SetBindingConfiguration(baseAddress.Scheme, serviceEndpointElement); serviceEndpointElement.Kind = this.standardEndpointKind; ServiceEndpoint serviceEndpoint = configLoader.LookupEndpoint(serviceEndpointElement, null, serviceHost, serviceHost.Description, true); this.ConfigureBinding(serviceEndpoint.Binding, baseAddress.Scheme, supportedSchemes, AspNetEnvironment.Enabled); // Setting the Endpoint address and listenUri now that we've set the binding security ConfigLoader.ConfigureEndpointAddress(serviceEndpointElement, serviceHost, serviceEndpoint); ConfigLoader.ConfigureEndpointListenUri(serviceEndpointElement, serviceHost, serviceEndpoint); return serviceEndpoint; }
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { base.OnInitializeAndValidate(serviceEndpointElement); ConfigurationUtility.InitializeAndValidateUdpServiceEndpointElement(serviceEndpointElement); }
protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { //no additional configuration is required for MEX. }
internal void Copy(ServiceEndpointElement source) { if (source == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source"); } PropertyInformationCollection properties = source.ElementInformation.Properties; if (properties[ConfigurationStrings.Address].ValueOrigin != PropertyValueOrigin.Default) { this.Address = source.Address; } if (properties[ConfigurationStrings.BehaviorConfiguration].ValueOrigin != PropertyValueOrigin.Default) { this.BehaviorConfiguration = source.BehaviorConfiguration; } if (properties[ConfigurationStrings.Binding].ValueOrigin != PropertyValueOrigin.Default) { this.Binding = source.Binding; } if (properties[ConfigurationStrings.BindingConfiguration].ValueOrigin != PropertyValueOrigin.Default) { this.BindingConfiguration = source.BindingConfiguration; } if (properties[ConfigurationStrings.Name].ValueOrigin != PropertyValueOrigin.Default) { this.Name = source.Name; } if (properties[ConfigurationStrings.BindingName].ValueOrigin != PropertyValueOrigin.Default) { this.BindingName = source.BindingName; } if (properties[ConfigurationStrings.BindingNamespace].ValueOrigin != PropertyValueOrigin.Default) { this.BindingNamespace = source.BindingNamespace; } if (properties[ConfigurationStrings.Contract].ValueOrigin != PropertyValueOrigin.Default) { this.Contract = source.Contract; } if (properties[ConfigurationStrings.Headers].ValueOrigin != PropertyValueOrigin.Default && source.Headers != null) { this.Headers.Copy(source.Headers); } if (properties[ConfigurationStrings.Identity].ValueOrigin != PropertyValueOrigin.Default && source.Identity != null) { this.Identity.Copy(source.Identity); } if (properties[ConfigurationStrings.ListenUriMode].ValueOrigin != PropertyValueOrigin.Default) { this.ListenUriMode = source.ListenUriMode; } if (properties[ConfigurationStrings.ListenUri].ValueOrigin != PropertyValueOrigin.Default) { this.ListenUri = source.ListenUri; } if (properties[ConfigurationStrings.IsSystemEndpoint].ValueOrigin != PropertyValueOrigin.Default) { this.IsSystemEndpoint = source.IsSystemEndpoint; } if (properties[ConfigurationStrings.Kind].ValueOrigin != PropertyValueOrigin.Default) { this.Kind = source.Kind; } if (properties[ConfigurationStrings.EndpointConfiguration].ValueOrigin != PropertyValueOrigin.Default) { this.EndpointConfiguration = source.EndpointConfiguration; } }
public void InitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { }
protected bool IsMetaDataEndpoint(ServiceEndpointElement ee) { if (ee.Contract == ServiceMetadataBehavior.MexContractName) return true; else return false; }
protected abstract void OnInitializeAndValidate(ServiceEndpointElement channelEndpointElement);
protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { InternalOnApplyConfiguration(endpoint); }
public static EndpointAddress CreateEndpointAddress(this ServiceEndpointElement el) { return(new EndpointAddress(el.Address, el.Identity != null ? el.Identity.CreateInstance() : null, el.Headers.Headers)); }
public static ServiceEndpoint ConfigureStandardEndpoint(ContractDescription cd, ServiceEndpointElement element) { string kind = element.Kind; string endpointConfiguration = element.EndpointConfiguration; EndpointCollectionElement section = ConfigUtil.StandardEndpointsSection [kind]; if (section == null) { throw new ArgumentException(String.Format("standard endpoint section for '{0}' was not found.", kind)); } StandardEndpointElement e = section.GetDefaultStandardEndpointElement(); ServiceEndpoint inst = e.CreateServiceEndpoint(cd); foreach (StandardEndpointElement el in section.ConfiguredEndpoints) { if (el.Name == endpointConfiguration) { el.InitializeAndValidate(element); el.ApplyConfiguration(inst, element); break; } } return(inst); }
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { throw new NotImplementedException(); }
protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { throw new NotImplementedException(); }
public void ApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { OnApplyConfiguration(endpoint, serviceEndpointElement); }
public void ApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { if (null == endpoint) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpoint"); } if (null == serviceEndpointElement) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("serviceEndpointElement"); } if (endpoint.GetType() != this.EndpointType) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.ConfigInvalidTypeForEndpoint, (this.EndpointType == null) ? string.Empty : this.EndpointType.AssemblyQualifiedName, endpoint.GetType().AssemblyQualifiedName)); } // The properties endpoint.Name and this.Name are actually two different things: // - endpoint.Name corresponds to the service endpoint name and is surfaced through // serviceEndpointElement.Name // - this.Name is a token used as a key in the endpoint collection to identify // a specific bucket of configuration settings. // Thus, the Name property is skipped here. this.OnApplyConfiguration(endpoint, serviceEndpointElement); }
protected abstract void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement);
public void InitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { OnInitializeAndValidate(serviceEndpointElement); }
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { if (!String.IsNullOrEmpty(serviceEndpointElement.Contract)) { throw FxTrace.Exception.AsError(new ConfigurationErrorsException(SR2.DiscoveryConfigContractSpecified(serviceEndpointElement.Kind))); } if (PropertyValueOrigin.Default == serviceEndpointElement.ElementInformation.Properties[ConfigurationStrings.IsSystemEndpoint].ValueOrigin) { serviceEndpointElement.IsSystemEndpoint = true; } }
public static System.ServiceModel.Description.ServiceEndpoint ConfigureStandardEndpoint (System.ServiceModel.Description.ContractDescription cd, ServiceEndpointElement element) { string kind = element.Kind; string endpointConfiguration = element.EndpointConfiguration; EndpointCollectionElement section = ConfigUtil.StandardEndpointsSection [kind]; if (section == null) throw new ArgumentException (String.Format ("standard endpoint section for '{0}' was not found.", kind)); StandardEndpointElement e = section.GetDefaultStandardEndpointElement (); System.ServiceModel.Description.ServiceEndpoint inst = e.CreateServiceEndpoint (cd); foreach (StandardEndpointElement el in section.ConfiguredEndpoints) { if (el.Name == endpointConfiguration) { el.InitializeAndValidate (element); el.ApplyConfiguration (inst, element); break; } } return inst; }
// returns true if added successfully, or false if didnt add due to duplicate. protected bool BaseAddEndpointConfig(Configuration config, EndpointConfig endpointConfig) { ServiceModelSectionGroup sg = ServiceModelSectionGroup.GetSectionGroup(config); ServiceElementCollection serviceColl = sg.Services.Services; ServiceElement serviceElement = null; // Find serviceElement foreach (ServiceElement el in serviceColl) { if (endpointConfig.MatchServiceType(el.Name)) { serviceElement = el; break; } } if (serviceElement == null) { // Didn't find one, create new element for this clsid serviceElement = new ServiceElement(endpointConfig.ServiceType); string baseServiceAddress = BaseServiceAddress(endpointConfig.Appid, endpointConfig.Clsid, endpointConfig.Iid); if (!String.IsNullOrEmpty(baseServiceAddress)) { BaseAddressElement bae = new BaseAddressElement(); bae.BaseAddress = baseServiceAddress; serviceElement.Host.BaseAddresses.Add(bae); } sg.Services.Services.Add(serviceElement); } if (endpointConfig.IsMexEndpoint) { EnsureComMetaDataExchangeBehaviorAdded(config); serviceElement.BehaviorConfiguration = comServiceBehavior; } bool methodsAdded = false; if (!endpointConfig.IsMexEndpoint) { methodsAdded = AddComContractToConfig(config, endpointConfig.InterfaceName, endpointConfig.Iid.ToString("B"), endpointConfig.Methods); } // Now, check if endpoint already exists.. foreach (ServiceEndpointElement ee in serviceElement.Endpoints) { bool listenerExists = true; if (this is ComplusEndpointConfigContainer) listenerExists = ((ComplusEndpointConfigContainer)this).ListenerComponentExists; if (endpointConfig.MatchContract(ee.Contract)) { if (listenerExists) return methodsAdded; // didn't add due to duplicate else serviceElement.Endpoints.Remove(ee); } } // All right, add the new endpoint now ServiceEndpointElement endpointElement = new ServiceEndpointElement(endpointConfig.Address, endpointConfig.ContractType); endpointElement.Binding = endpointConfig.BindingType; endpointElement.BindingConfiguration = endpointConfig.BindingName; serviceElement.Endpoints.Add(endpointElement); AddBinding(config); return true; }
internal void Copy(ServiceEndpointElement source) { if (source == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source"); } PropertyInformationCollection properties = source.ElementInformation.Properties; if (properties[ConfigurationStrings.Address].ValueOrigin != PropertyValueOrigin.Default) { this.Address = source.Address; } if (properties[ConfigurationStrings.BehaviorConfiguration].ValueOrigin != PropertyValueOrigin.Default) { this.BehaviorConfiguration = source.BehaviorConfiguration; } if (properties[ConfigurationStrings.Binding].ValueOrigin != PropertyValueOrigin.Default) { this.Binding = source.Binding; } if (properties[ConfigurationStrings.BindingConfiguration].ValueOrigin != PropertyValueOrigin.Default) { this.BindingConfiguration = source.BindingConfiguration; } if (properties[ConfigurationStrings.Name].ValueOrigin != PropertyValueOrigin.Default) { this.Name = source.Name; } if (properties[ConfigurationStrings.BindingName].ValueOrigin != PropertyValueOrigin.Default) { this.BindingName = source.BindingName; } if (properties[ConfigurationStrings.BindingNamespace].ValueOrigin != PropertyValueOrigin.Default) { this.BindingNamespace = source.BindingNamespace; } if (properties[ConfigurationStrings.Contract].ValueOrigin != PropertyValueOrigin.Default) { this.Contract = source.Contract; } if (properties[ConfigurationStrings.Headers].ValueOrigin != PropertyValueOrigin.Default && source.Headers != null) { this.Headers.Copy(source.Headers); } if (properties[ConfigurationStrings.Identity].ValueOrigin != PropertyValueOrigin.Default && source.Identity != null) { this.Identity.Copy(source.Identity); } if (properties[ConfigurationStrings.ListenUriMode].ValueOrigin != PropertyValueOrigin.Default) { this.ListenUriMode = source.ListenUriMode; } if (properties[ConfigurationStrings.ListenUri].ValueOrigin != PropertyValueOrigin.Default) { this.ListenUri = source.ListenUri; } if (properties[ConfigurationStrings.IsSystemEndpoint].ValueOrigin != PropertyValueOrigin.Default) { this.IsSystemEndpoint = source.IsSystemEndpoint; } if (properties[ConfigurationStrings.Kind].ValueOrigin != PropertyValueOrigin.Default) { this.Kind = source.Kind; } if (properties[ConfigurationStrings.EndpointConfiguration].ValueOrigin != PropertyValueOrigin.Default) { this.EndpointConfiguration = source.EndpointConfiguration; } }
public void ApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { }
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { throw FxTrace.Exception.AsError( new InvalidOperationException( SR.DiscoveryConfigDynamicEndpointInService(serviceEndpointElement.Kind))); }
protected abstract void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement);
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { if (endpoint == null) throw new ArgumentNullException ("endpoint"); AnnouncementEndpoint ae = (AnnouncementEndpoint) endpoint; if (!ae.DiscoveryVersion.Equals (DiscoveryVersion)) throw new ArgumentException ("Argument AnnouncementEndpoint is initialized with different DiscoveryVersion"); ae.MaxAnnouncementDelay = MaxAnnouncementDelay; ae.Address = serviceEndpointElement.CreateEndpointAddress (); // it depends on InternalVisibleTo(System.ServiceModel) ae.Binding = ConfigUtil.CreateBinding (serviceEndpointElement.Binding, serviceEndpointElement.BindingConfiguration); // it depends on InternalVisibleTo(System.ServiceModel) }
protected abstract void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement);
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { throw new NotImplementedException (); }
public ContractInfo(Guid iid, ServiceEndpointElement endpoint, ComCatalogObject interfaceObject, ComCatalogObject application) { this.name = endpoint.Contract; this.iid = iid; // Interface Roles // ComCatalogCollection roles; roles = interfaceObject.GetCollection("RolesForInterface"); this.interfaceRoleMembers = CatalogUtil.GetRoleMembers(application, roles); // Operations // this.operations = new List<OperationInfo>(); ComCatalogCollection methods; methods = interfaceObject.GetCollection("MethodsForInterface"); foreach (ComCatalogObject method in methods) { this.operations.Add(new OperationInfo(method, application)); } }
public void ApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { }
protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { base.OnApplyConfiguration(endpoint, serviceEndpointElement); ApplyConfiguration(endpoint); }
protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { }
protected abstract void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement);
protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { }
protected override void OnInitializeAndValidate (ServiceEndpointElement serviceEndpointElement) { // It seems to do nothing. }
protected abstract void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement channelEndpointElement);
protected override void OnInitializeAndValidate (ServiceEndpointElement serviceEndpointElement) { throw new NotImplementedException (); }
protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { //no additional configuration is required for MEX. }