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
- ResourceSetExpression.cs
- ImageCodecInfoPrivate.cs
- AppSecurityManager.cs
- CodeTypeMember.cs
- SizeChangedInfo.cs
- GB18030Encoding.cs
- FigureHelper.cs
- TemplateBuilder.cs
- ScalarRestriction.cs
- MsmqIntegrationMessagePool.cs
- ClientApiGenerator.cs
- GeneralTransformCollection.cs
- PinnedBufferMemoryStream.cs
- AttributeSetAction.cs
- DiagnosticsConfiguration.cs
- XmlBoundElement.cs
- PingReply.cs
- ReaderOutput.cs
- InputScope.cs
- DataServiceStreamProviderWrapper.cs
- DataControlImageButton.cs
- SqlMethodAttribute.cs
- VisualBasicValue.cs
- HtmlElement.cs
- DWriteFactory.cs
- TcpChannelHelper.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- LicenseProviderAttribute.cs
- TypeDependencyAttribute.cs
- GradientStop.cs
- FamilyMap.cs
- Normalization.cs
- SafeNativeMemoryHandle.cs
- InkPresenter.cs
- TextTreeNode.cs
- ToolStripGrip.cs
- DesignerDataTableBase.cs
- ControlBindingsCollection.cs
- ControlParameter.cs
- ConfigurationPropertyCollection.cs
- DefaultAssemblyResolver.cs
- ProvidePropertyAttribute.cs
- RangeValuePattern.cs
- CounterCreationDataCollection.cs
- BrowserTree.cs
- httpstaticobjectscollection.cs
- Rect3DConverter.cs
- VersionPair.cs
- TreeViewItem.cs
- TreeNode.cs
- Canvas.cs
- FixedSOMTableRow.cs
- EnumBuilder.cs
- FragmentQueryProcessor.cs
- FrugalMap.cs
- XhtmlBasicTextViewAdapter.cs
- RemoteWebConfigurationHost.cs
- XmlTypeMapping.cs
- DesignerDataSourceView.cs
- WorkflowRuntimeSection.cs
- ToolStripGrip.cs
- Geometry.cs
- StrokeFIndices.cs
- Convert.cs
- URLIdentityPermission.cs
- OdbcUtils.cs
- SelectionItemProviderWrapper.cs
- KnownIds.cs
- IndexedEnumerable.cs
- HandlerBase.cs
- updatecommandorderer.cs
- FormViewCommandEventArgs.cs
- SessionIDManager.cs
- Msec.cs
- OdbcConnectionFactory.cs
- LiteralDesigner.cs
- InternalBufferManager.cs
- SQLResource.cs
- CatalogPartDesigner.cs
- SerializerWriterEventHandlers.cs
- Resources.Designer.cs
- FontFamily.cs
- Container.cs
- SettingsPropertyValue.cs
- SqlConnectionHelper.cs
- CommonXSendMessage.cs
- DataTemplateSelector.cs
- TraversalRequest.cs
- StrongNameKeyPair.cs
- SqlClientFactory.cs
- DBCSCodePageEncoding.cs
- ModifierKeysConverter.cs
- ImpersonateTokenRef.cs
- FixUp.cs
- EDesignUtil.cs
- SelectionRange.cs
- CellCreator.cs
- WebDisplayNameAttribute.cs
- dataprotectionpermissionattribute.cs
- AnnotationStore.cs