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
- PtsHost.cs
- ProcessHostMapPath.cs
- HashMembershipCondition.cs
- BitmapEffect.cs
- DateTimeStorage.cs
- Int16Converter.cs
- ControlCachePolicy.cs
- XmlSchemaDocumentation.cs
- BaseParser.cs
- AddressHeader.cs
- ToolboxSnapDragDropEventArgs.cs
- OpacityConverter.cs
- SamlDoNotCacheCondition.cs
- DeferredSelectedIndexReference.cs
- HtmlControlPersistable.cs
- MeasurementDCInfo.cs
- TypeDescriptor.cs
- CookieParameter.cs
- TypeBuilderInstantiation.cs
- WSHttpSecurity.cs
- TcpActivation.cs
- MdiWindowListStrip.cs
- DataServiceEntityAttribute.cs
- TextMessageEncodingBindingElement.cs
- StateRuntime.cs
- OpacityConverter.cs
- AssemblyUtil.cs
- SelectionItemPattern.cs
- SafeEventLogReadHandle.cs
- StorageAssociationSetMapping.cs
- XmlValidatingReader.cs
- OracleEncoding.cs
- Attributes.cs
- ObjectItemConventionAssemblyLoader.cs
- SoapObjectReader.cs
- ArrayConverter.cs
- SoapHeader.cs
- XmlTextEncoder.cs
- InstanceOwnerException.cs
- DataObject.cs
- Set.cs
- RuleConditionDialog.cs
- CmsInterop.cs
- SessionViewState.cs
- FrameworkName.cs
- DataGridColumnHeaderCollection.cs
- EventTrigger.cs
- XmlEntityReference.cs
- OleDbRowUpdatedEvent.cs
- PasswordBox.cs
- peersecurityelement.cs
- Guid.cs
- CharacterBuffer.cs
- HttpRawResponse.cs
- Int32EqualityComparer.cs
- LogSwitch.cs
- HtmlTernaryTree.cs
- RenameRuleObjectDialog.cs
- URIFormatException.cs
- VersionConverter.cs
- Assembly.cs
- NonParentingControl.cs
- PathParser.cs
- DependencySource.cs
- ModelItem.cs
- MaskedTextProvider.cs
- DbConnectionHelper.cs
- Gdiplus.cs
- JournalEntryStack.cs
- ConnectionsZone.cs
- CheckBoxStandardAdapter.cs
- ComplexTypeEmitter.cs
- MessagePropertyFilter.cs
- X509Certificate.cs
- CodeDelegateCreateExpression.cs
- OutKeywords.cs
- Setter.cs
- ControlBuilder.cs
- ProxyElement.cs
- TextEditorCopyPaste.cs
- ModuleBuilderData.cs
- UnsafeNativeMethods.cs
- DataChangedEventManager.cs
- LoadWorkflowAsyncResult.cs
- TraceListener.cs
- WindowsGraphics.cs
- EditorPart.cs
- SafePEFileHandle.cs
- PrincipalPermission.cs
- Content.cs
- TabPanel.cs
- CodeRegionDirective.cs
- ApplicationServiceManager.cs
- ProfileServiceManager.cs
- JsonSerializer.cs
- QuaternionAnimationBase.cs
- CodeExporter.cs
- NativeMethods.cs
- PerfCounterSection.cs
- ValidationHelpers.cs