Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Web / WebChannelFactory.cs / 1305376 / 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.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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XNodeValidator.cs
- Tokenizer.cs
- LinqExpressionNormalizer.cs
- XmlCustomFormatter.cs
- TdsEnums.cs
- ConditionalExpression.cs
- SerializationAttributes.cs
- ViewCellSlot.cs
- ErrorRuntimeConfig.cs
- WebPartEditVerb.cs
- WebZone.cs
- IdentitySection.cs
- XPathSingletonIterator.cs
- DelimitedListTraceListener.cs
- MouseOverProperty.cs
- PublisherMembershipCondition.cs
- RuntimeComponentFilter.cs
- SmiEventStream.cs
- TextBox.cs
- TextElementEnumerator.cs
- ObfuscateAssemblyAttribute.cs
- PersonalizationState.cs
- ChannelManager.cs
- TextReader.cs
- DbMetaDataFactory.cs
- GatewayIPAddressInformationCollection.cs
- EventInfo.cs
- TableLayoutSettingsTypeConverter.cs
- DataListItemEventArgs.cs
- RangeValidator.cs
- ColumnResizeUndoUnit.cs
- Schema.cs
- EdmProviderManifest.cs
- MsmqUri.cs
- FrameworkObject.cs
- TcpConnectionPoolSettings.cs
- ResolvedKeyFrameEntry.cs
- serverconfig.cs
- XmlSerializerSection.cs
- AnimatedTypeHelpers.cs
- RemoteWebConfigurationHost.cs
- HostedController.cs
- Completion.cs
- VerbConverter.cs
- OlePropertyStructs.cs
- IItemProperties.cs
- CodeTypeReferenceSerializer.cs
- ListParagraph.cs
- CustomAssemblyResolver.cs
- FormViewRow.cs
- XmlQueryRuntime.cs
- TrustLevel.cs
- HandleCollector.cs
- Oid.cs
- MenuItemBindingCollection.cs
- AutoGeneratedField.cs
- TextEffectResolver.cs
- SessionEndedEventArgs.cs
- WindowsTokenRoleProvider.cs
- XmlBinaryReader.cs
- NameSpaceExtractor.cs
- _ShellExpression.cs
- IntegerValidator.cs
- ToolStrip.cs
- ConfigurationManager.cs
- XPathNavigator.cs
- ThrowHelper.cs
- FileStream.cs
- TextHidden.cs
- AutomationPatternInfo.cs
- TracedNativeMethods.cs
- BoundField.cs
- IsolatedStoragePermission.cs
- _ProxyRegBlob.cs
- LayoutDump.cs
- KnownTypesProvider.cs
- HScrollProperties.cs
- ISAPIRuntime.cs
- DocumentSignatureManager.cs
- BinaryObjectWriter.cs
- ObjectSecurity.cs
- DateTimeOffset.cs
- LookupTables.cs
- SettingsAttributes.cs
- StateInitialization.cs
- EntityDataSourceDataSelectionPanel.cs
- Debugger.cs
- OleDbSchemaGuid.cs
- TextEditorCopyPaste.cs
- SerTrace.cs
- ObjectDataSourceDisposingEventArgs.cs
- WebUtil.cs
- TypeUsage.cs
- RefType.cs
- TextContainer.cs
- SmtpMail.cs
- GAC.cs
- AssemblyAttributesGoHere.cs
- ClientSettingsSection.cs
- CommandManager.cs