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
- Barrier.cs
- XPathNodeList.cs
- Int16AnimationBase.cs
- PreservationFileWriter.cs
- DateTimeUtil.cs
- MetadataArtifactLoaderCompositeResource.cs
- UInt64Storage.cs
- PlanCompilerUtil.cs
- AnimationTimeline.cs
- Parameter.cs
- Tile.cs
- TextEndOfLine.cs
- CryptoStream.cs
- UnsafeNativeMethods.cs
- DocComment.cs
- ControlType.cs
- PropertyChangedEventManager.cs
- XsdCachingReader.cs
- SystemIcmpV6Statistics.cs
- ListParaClient.cs
- AsyncPostBackErrorEventArgs.cs
- EventMappingSettings.cs
- ControlDesigner.cs
- PasswordRecovery.cs
- ClipboardProcessor.cs
- ValueQuery.cs
- SafeCertificateContext.cs
- LinqDataSourceDeleteEventArgs.cs
- SelfIssuedAuthRSACryptoProvider.cs
- AggregationMinMaxHelpers.cs
- SQLInt64Storage.cs
- ToolStripAdornerWindowService.cs
- XmlSubtreeReader.cs
- CacheEntry.cs
- OpCellTreeNode.cs
- AsnEncodedData.cs
- MiniCustomAttributeInfo.cs
- recordstatefactory.cs
- Variant.cs
- Converter.cs
- DataMemberConverter.cs
- EnumValAlphaComparer.cs
- SystemNetworkInterface.cs
- SocketPermission.cs
- SqlDataSourceView.cs
- DocumentPageHost.cs
- StylusShape.cs
- COM2PictureConverter.cs
- DataGridViewCheckBoxColumn.cs
- FileDialogCustomPlacesCollection.cs
- X509IssuerSerialKeyIdentifierClause.cs
- BinaryParser.cs
- securitycriticaldata.cs
- Select.cs
- PenLineJoinValidation.cs
- ColorTransformHelper.cs
- DataGridColumnHeadersPresenter.cs
- Hyperlink.cs
- WebPartConnectionsDisconnectVerb.cs
- IntPtr.cs
- MimeTypePropertyAttribute.cs
- HttpRuntimeSection.cs
- ConstructorExpr.cs
- SolidColorBrush.cs
- CollectionsUtil.cs
- EqualityComparer.cs
- EncodingFallbackAwareXmlTextWriter.cs
- CqlIdentifiers.cs
- CompatibleComparer.cs
- SchemaImporterExtensionsSection.cs
- SelectionRangeConverter.cs
- ErrorFormatterPage.cs
- CompilerParameters.cs
- DeclarativeCatalogPartDesigner.cs
- SequentialUshortCollection.cs
- DocumentPageView.cs
- AttachedPropertyInfo.cs
- DeflateStream.cs
- ResourceAssociationSetEnd.cs
- TextWriterEngine.cs
- AssociationType.cs
- StreamUpdate.cs
- PanelDesigner.cs
- ArgumentDesigner.xaml.cs
- IdentityModelDictionary.cs
- EventProviderWriter.cs
- DeploymentSection.cs
- TableLayoutPanel.cs
- PointCollectionConverter.cs
- ListControlConvertEventArgs.cs
- DocumentEventArgs.cs
- SystemBrushes.cs
- TextServicesContext.cs
- FlowchartDesignerCommands.cs
- ApplyHostConfigurationBehavior.cs
- ImageMetadata.cs
- TextMarkerSource.cs
- Sql8ExpressionRewriter.cs
- CardSpaceException.cs
- Style.cs