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
- XmlLoader.cs
- WebHttpBehavior.cs
- TextTreeInsertElementUndoUnit.cs
- IndexedEnumerable.cs
- WebPartConnectionsCancelEventArgs.cs
- FileDialog_Vista.cs
- Exceptions.cs
- CompilerWrapper.cs
- XmlQueryCardinality.cs
- DbProviderSpecificTypePropertyAttribute.cs
- XamlGridLengthSerializer.cs
- PassportIdentity.cs
- FakeModelPropertyImpl.cs
- CompensationHandlingFilter.cs
- ButtonBase.cs
- DesignerDataSourceView.cs
- VisualStateChangedEventArgs.cs
- CompiledQueryCacheKey.cs
- StrokeDescriptor.cs
- NonDualMessageSecurityOverHttpElement.cs
- ModuleBuilderData.cs
- WebBrowserContainer.cs
- Pick.cs
- ParseNumbers.cs
- EdmMember.cs
- RouteValueExpressionBuilder.cs
- SamlSecurityTokenAuthenticator.cs
- WindowsListViewScroll.cs
- PropertyManager.cs
- SystemPens.cs
- PolyQuadraticBezierSegment.cs
- DescendantBaseQuery.cs
- AuthorizationRuleCollection.cs
- TheQuery.cs
- CngProperty.cs
- MailHeaderInfo.cs
- PropertyGridView.cs
- OdbcException.cs
- ToolStripItemEventArgs.cs
- MsmqAppDomainProtocolHandler.cs
- XomlSerializationHelpers.cs
- ImageCodecInfo.cs
- ProgressBar.cs
- OrderedDictionary.cs
- ColorMap.cs
- HttpServerUtilityBase.cs
- PermissionToken.cs
- MessageDecoder.cs
- DeriveBytes.cs
- ToolStripItemCollection.cs
- WebPartAuthorizationEventArgs.cs
- XmlReaderDelegator.cs
- Brushes.cs
- EntitySetBase.cs
- SelectionRange.cs
- DetailsViewPagerRow.cs
- SmtpLoginAuthenticationModule.cs
- ErrorRuntimeConfig.cs
- BindingSource.cs
- ManagementPath.cs
- ScrollPattern.cs
- BitmapEffect.cs
- ResizeGrip.cs
- TableCell.cs
- ObjectReferenceStack.cs
- EventWaitHandle.cs
- SafeTokenHandle.cs
- BaseUriHelper.cs
- CheckBoxRenderer.cs
- BookmarkManager.cs
- HttpApplicationFactory.cs
- SystemUdpStatistics.cs
- NotifyInputEventArgs.cs
- MimeFormReflector.cs
- WebPartDesigner.cs
- DataGridViewHitTestInfo.cs
- KeyValuePair.cs
- InternalCache.cs
- XmlSchemaAnnotated.cs
- Trigger.cs
- MemberRelationshipService.cs
- Axis.cs
- ColorTypeConverter.cs
- AdapterUtil.cs
- BasicHttpMessageSecurityElement.cs
- TransformDescriptor.cs
- ProbeDuplexAsyncResult.cs
- MergeFilterQuery.cs
- Currency.cs
- Monitor.cs
- RadioButtonPopupAdapter.cs
- CompositionDesigner.cs
- ResourceExpressionEditor.cs
- DataGridViewRowsRemovedEventArgs.cs
- SubpageParaClient.cs
- MethodBuilder.cs
- TransactionContext.cs
- TreeNodeStyleCollection.cs
- _NestedMultipleAsyncResult.cs
- SBCSCodePageEncoding.cs