public void Ctor () { UriSchemeKeyedCollection u = new UriSchemeKeyedCollection ( new Uri [] { new Uri ("http://localhost", UriKind.Absolute), new Uri ("ftp://someotherhost", UriKind.Absolute) } ); Assert.AreEqual (u.Count, 2, "#1"); }
void InitializeDescription(WorkflowService serviceDefinition, UriSchemeKeyedCollection baseAddresses) { Fx.Assert(serviceDefinition != null, "caller must verify"); this.serviceDefinition = serviceDefinition; base.InitializeDescription(baseAddresses); foreach (Endpoint endpoint in serviceDefinition.Endpoints) { if (endpoint.Binding == null) { string endpointName = ContractValidationHelper.GetErrorMessageEndpointName(endpoint.Name); string contractName = ContractValidationHelper.GetErrorMessageEndpointServiceContractName(endpoint.ServiceContractName); throw FxTrace.Exception.AsError(new InvalidOperationException(SR.MissingBindingInEndpoint(endpointName, contractName))); } ServiceEndpoint serviceEndpoint = AddServiceEndpointCore(endpoint.ServiceContractName, endpoint.Binding, endpoint.GetAddress(this), endpoint.ListenUri, endpoint.BehaviorConfigurationName); if (!string.IsNullOrEmpty(endpoint.Name)) { serviceEndpoint.Name = endpoint.Name; } serviceEndpoint.UnresolvedAddress = endpoint.AddressUri; serviceEndpoint.UnresolvedListenUri = endpoint.ListenUri; } this.PersistTimeout = defaultPersistTimeout; this.TrackTimeout = defaultTrackTimeout; this.FilterResumeTimeout = defaultFilterResumeTimeout; }
internal void OnDeserialized(StreamingContext context) { UriSchemeKeyedCollection.ValidateBaseAddress(this.baseAddress, "context"); if (!HostNameComparisonModeHelper.IsDefined(this.HostNameComparisonMode)) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("context", System.ServiceModel.SR.GetString("Hosting_BaseUriDeserializedNotValid")); } this.SetComparisonAddressAndHashCode(); }
public void Ctor() { UriSchemeKeyedCollection u = new UriSchemeKeyedCollection(new Uri [] { new Uri("http://localhost", UriKind.Absolute), new Uri("ftp://someotherhost", UriKind.Absolute) }); Assert.AreEqual(u.Count, 2, "#1"); }
internal void OnDeserialized(StreamingContext context) { UriSchemeKeyedCollection.ValidateBaseAddress(_baseAddress, "context"); if (!HostNameComparisonModeHelper.IsDefined(HostNameComparisonMode)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("context", SR.Hosting_BaseUriDeserializedNotValid); } SetComparisonAddressAndHashCode(); }
/// <summary> /// Initializes a new instance of the <see cref="NinjectAbstractWebServiceHost{T}"/> class. /// </summary> /// <param name="serviceBehavior">The service behavior.</param> /// <param name="instance">The instance.</param> /// <param name="baseBaseAddresses">The base addresses.</param> protected NinjectAbstractWebServiceHost(IServiceBehavior serviceBehavior, T instance, Uri[] baseBaseAddresses) : base(serviceBehavior) { var addresses = new UriSchemeKeyedCollection(baseBaseAddresses); if (ServiceTypeHelper.IsSingletonService(instance)) { this.InitializeDescription(instance, addresses); } else { this.InitializeDescription(typeof(T), addresses); } }
internal static Uri GetVia(string scheme, Uri address, UriSchemeKeyedCollection baseAddresses) { Uri via = address; if (!via.IsAbsoluteUri) { if (!baseAddresses.Contains(scheme)) { return(null); } via = GetUri(baseAddresses[scheme], address.OriginalString); } return(via); }
protected void InitializeDescription(Object singletonInstance, UriSchemeKeyedCollection baseAddresses) { Contract.Requires(baseAddresses != null); }
protected void InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses) { Contract.Requires(baseAddresses != null); }
void InitializeDescription(WorkflowDefinitionContext workflowDefinitionContext, UriSchemeKeyedCollection baseAddresses) { this.workflowDefinitionContext = workflowDefinitionContext; this.InitializeDescription(baseAddresses); if (!this.Description.Behaviors.Contains(typeof(WorkflowRuntimeBehavior))) { this.Description.Behaviors.Add(new WorkflowRuntimeBehavior()); } }
protected TransportChannelListener(TransportBindingElement bindingElement, BindingContext context, System.ServiceModel.Channels.MessageEncoderFactory defaultMessageEncoderFactory, HostNameComparisonMode hostNameComparisonMode) : base(context.Binding) { HostNameComparisonModeHelper.Validate(hostNameComparisonMode); this.hostNameComparisonMode = hostNameComparisonMode; this.manualAddressing = bindingElement.ManualAddressing; this.maxBufferPoolSize = bindingElement.MaxBufferPoolSize; this.maxReceivedMessageSize = bindingElement.MaxReceivedMessageSize; Collection <MessageEncodingBindingElement> collection = context.BindingParameters.FindAll <MessageEncodingBindingElement>(); if (collection.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("MultipleMebesInParameters"))); } if (collection.Count == 1) { this.messageEncoderFactory = collection[0].CreateMessageEncoderFactory(); context.BindingParameters.Remove <MessageEncodingBindingElement>(); } else { this.messageEncoderFactory = defaultMessageEncoderFactory; } if (this.messageEncoderFactory != null) { this.messageVersion = this.messageEncoderFactory.MessageVersion; } else { this.messageVersion = System.ServiceModel.Channels.MessageVersion.None; } ServiceSecurityAuditBehavior behavior = context.BindingParameters.Find <ServiceSecurityAuditBehavior>(); if (behavior != null) { this.auditBehavior = behavior.Clone(); } else { this.auditBehavior = new ServiceSecurityAuditBehavior(); } if ((context.ListenUriMode == ListenUriMode.Unique) && (context.ListenUriBaseAddress == null)) { UriBuilder builder = new UriBuilder(this.Scheme, DnsCache.MachineName) { Path = this.GeneratedAddressPrefix }; context.ListenUriBaseAddress = builder.Uri; } UriSchemeKeyedCollection.ValidateBaseAddress(context.ListenUriBaseAddress, "baseAddress"); if ((context.ListenUriBaseAddress.Scheme != this.Scheme) && (string.Compare(context.ListenUriBaseAddress.Scheme, this.Scheme, StringComparison.OrdinalIgnoreCase) != 0)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("context.ListenUriBaseAddress", System.ServiceModel.SR.GetString("InvalidUriScheme", new object[] { context.ListenUriBaseAddress.Scheme, this.Scheme })); } if (context.ListenUriMode == ListenUriMode.Explicit) { this.SetUri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress); } else { string listenUriRelativeAddress = context.ListenUriRelativeAddress; if ((listenUriRelativeAddress.Length > 0) && !listenUriRelativeAddress.EndsWith("/", StringComparison.Ordinal)) { listenUriRelativeAddress = listenUriRelativeAddress + "/"; } this.SetUri(context.ListenUriBaseAddress, listenUriRelativeAddress + Guid.NewGuid().ToString()); } this.transportManagerContainer = new TransportManagerContainer(this); }
public new void InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses) { base.InitializeDescription(serviceType, baseAddresses); }
public ServiceHostNoConfig(string address) { UriSchemeKeyedCollection c = new UriSchemeKeyedCollection(new Uri(address)); InitializeDescription(typeof(S), c); }
protected TransportChannelListener(TransportBindingElement bindingElement, BindingContext context, MessageEncoderFactory defaultMessageEncoderFactory, HostNameComparisonMode hostNameComparisonMode) : base(context.Binding) { HostNameComparisonModeHelper.Validate(hostNameComparisonMode); this.hostNameComparisonMode = hostNameComparisonMode; this.manualAddressing = bindingElement.ManualAddressing; this.maxBufferPoolSize = bindingElement.MaxBufferPoolSize; this.maxReceivedMessageSize = bindingElement.MaxReceivedMessageSize; Collection <MessageEncodingBindingElement> messageEncoderBindingElements = context.BindingParameters.FindAll <MessageEncodingBindingElement>(); if (messageEncoderBindingElements.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.MultipleMebesInParameters))); } else if (messageEncoderBindingElements.Count == 1) { this.messageEncoderFactory = messageEncoderBindingElements[0].CreateMessageEncoderFactory(); context.BindingParameters.Remove <MessageEncodingBindingElement>(); } else { this.messageEncoderFactory = defaultMessageEncoderFactory; } if (null != this.messageEncoderFactory) { this.messageVersion = this.messageEncoderFactory.MessageVersion; } else { this.messageVersion = MessageVersion.None; } ServiceSecurityAuditBehavior auditBehavior = context.BindingParameters.Find <ServiceSecurityAuditBehavior>(); if (auditBehavior != null) { this.auditBehavior = auditBehavior.Clone(); } else { this.auditBehavior = new ServiceSecurityAuditBehavior(); } if ((context.ListenUriMode == ListenUriMode.Unique) && (context.ListenUriBaseAddress == null)) { UriBuilder uriBuilder = new UriBuilder(this.Scheme, DnsCache.MachineName); uriBuilder.Path = this.GeneratedAddressPrefix; context.ListenUriBaseAddress = uriBuilder.Uri; } UriSchemeKeyedCollection.ValidateBaseAddress(context.ListenUriBaseAddress, "baseAddress"); if (context.ListenUriBaseAddress.Scheme != this.Scheme) { // URI schemes are case-insensitive, so try a case insensitive compare now if (string.Compare(context.ListenUriBaseAddress.Scheme, this.Scheme, StringComparison.OrdinalIgnoreCase) != 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument( "context.ListenUriBaseAddress", SR.GetString(SR.InvalidUriScheme, context.ListenUriBaseAddress.Scheme, this.Scheme)); } } Fx.Assert(context.ListenUriRelativeAddress != null, ""); // validated by BindingContext if (context.ListenUriMode == ListenUriMode.Explicit) { this.SetUri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress); } else // ListenUriMode.Unique: { string relativeAddress = context.ListenUriRelativeAddress; if (relativeAddress.Length > 0 && !relativeAddress.EndsWith("/", StringComparison.Ordinal)) { relativeAddress += "/"; } this.SetUri(context.ListenUriBaseAddress, relativeAddress + Guid.NewGuid().ToString()); } this.transportManagerContainer = new TransportManagerContainer(this); }