Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Web / WebChannelFactory.cs / 2 / WebChannelFactory.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Web { using System.IO; using System.Collections.Generic; using System.ServiceModel; using System.ServiceModel.Activation; using System.ServiceModel.Channels; using System.ServiceModel.Description; using System.Diagnostics.CodeAnalysis; using System.Configuration; using System.Net; using System.Web; using System.Globalization; public class WebChannelFactory: ChannelFactory where TChannel : class { public WebChannelFactory() : base() { } public WebChannelFactory(Binding binding) : base(binding) { } public WebChannelFactory(ServiceEndpoint endpoint) : base(endpoint) { } [SuppressMessage("Microsoft.Design", "CA1057:StringUriOverloadsCallSystemUriOverloads", Justification = "This is a configuration string and not a network location")] public WebChannelFactory(string endpointConfigurationName) : base(endpointConfigurationName) { } public WebChannelFactory(Type channelType) : base(channelType) { } public WebChannelFactory(Uri remoteAddress) : this(GetDefaultBinding(remoteAddress), remoteAddress) { } public WebChannelFactory(Binding binding, Uri remoteAddress) : base(binding, (remoteAddress != null) ? new EndpointAddress(remoteAddress) : null) { } public WebChannelFactory(string endpointConfigurationName, Uri remoteAddress) : base(endpointConfigurationName, (remoteAddress != null) ? new EndpointAddress(remoteAddress) : null) { } protected override void OnOpening() { if (this.Endpoint == null) { return; } // if the binding is missing, set up a default binding if (this.Endpoint.Binding == null && this.Endpoint.Address != null) { this.Endpoint.Binding = GetDefaultBinding(this.Endpoint.Address.Uri); } WebServiceHost.SetRawContentTypeMapperIfNecessary(this.Endpoint, false); if (this.Endpoint.Behaviors.Find () == null) { this.Endpoint.Behaviors.Add(new WebHttpBehavior()); } base.OnOpening(); } static Binding GetDefaultBinding(Uri remoteAddress) { if (remoteAddress == null || (remoteAddress.Scheme != Uri.UriSchemeHttp && remoteAddress.Scheme != Uri.UriSchemeHttps)) { return null; } if (remoteAddress.Scheme == Uri.UriSchemeHttp) { return new WebHttpBinding(); } else { WebHttpBinding result = new WebHttpBinding(); result.Security.Mode = WebHttpSecurityMode.Transport; result.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; return result; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExpressionReplacer.cs
- PropertyPathWorker.cs
- OracleMonthSpan.cs
- SessionStateContainer.cs
- TreeView.cs
- BindingGroup.cs
- CodeObject.cs
- BasicKeyConstraint.cs
- ColorConverter.cs
- XmlNullResolver.cs
- ListDataHelper.cs
- _SslState.cs
- HWStack.cs
- DiscoveryCallbackBehavior.cs
- DataGridViewComboBoxColumn.cs
- XamlFigureLengthSerializer.cs
- StrokeNode.cs
- EncodingTable.cs
- FreezableDefaultValueFactory.cs
- DataRow.cs
- XpsDigitalSignature.cs
- ItemContainerGenerator.cs
- TextBoxBase.cs
- XmlILOptimizerVisitor.cs
- IconConverter.cs
- ZoneButton.cs
- Tablet.cs
- DataGridItemAttachedStorage.cs
- MethodToken.cs
- GridViewColumnHeaderAutomationPeer.cs
- ClosableStream.cs
- SqlDataSourceView.cs
- UniqueID.cs
- InstalledVoice.cs
- RtfControls.cs
- UnsafeNativeMethods.cs
- EditorBrowsableAttribute.cs
- HtmlHistory.cs
- CredentialCache.cs
- FrameworkContentElement.cs
- HtmlCommandAdapter.cs
- WhitespaceSignificantCollectionAttribute.cs
- WinCategoryAttribute.cs
- ExtentKey.cs
- GenericEnumerator.cs
- DirectionalLight.cs
- BlockUIContainer.cs
- MarkupCompilePass1.cs
- CheckBoxField.cs
- MessageRpc.cs
- PointKeyFrameCollection.cs
- GenericEnumConverter.cs
- SelectionPattern.cs
- EDesignUtil.cs
- ImageListUtils.cs
- CodeExporter.cs
- TraceContextEventArgs.cs
- WeakHashtable.cs
- UICuesEvent.cs
- LogStream.cs
- _AuthenticationState.cs
- ListenerSingletonConnectionReader.cs
- HtmlHead.cs
- QueryOptionExpression.cs
- DbDataSourceEnumerator.cs
- ParagraphResult.cs
- updateconfighost.cs
- UnsupportedPolicyOptionsException.cs
- TreeNodeBinding.cs
- AddressHeaderCollectionElement.cs
- LogPolicy.cs
- X509SubjectKeyIdentifierClause.cs
- DrawListViewSubItemEventArgs.cs
- SctClaimSerializer.cs
- EmbeddedObject.cs
- IisHelper.cs
- BuilderElements.cs
- WindowShowOrOpenTracker.cs
- ListControlBuilder.cs
- XhtmlStyleClass.cs
- PenThreadPool.cs
- MdImport.cs
- VoiceChangeEventArgs.cs
- PropertyState.cs
- NamedPipeConnectionPool.cs
- XPathSingletonIterator.cs
- ScopelessEnumAttribute.cs
- OwnerDrawPropertyBag.cs
- EmptyControlCollection.cs
- GregorianCalendarHelper.cs
- tabpagecollectioneditor.cs
- FeatureSupport.cs
- RouteTable.cs
- MetadataArtifactLoaderComposite.cs
- OdbcDataReader.cs
- SwitchAttribute.cs
- ReliableSessionBindingElement.cs
- LayoutTable.cs
- SerializationException.cs
- HttpRawResponse.cs