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
- SmtpException.cs
- ConnectionStringsExpressionBuilder.cs
- SafeCertificateStore.cs
- AsmxEndpointPickerExtension.cs
- DataContractJsonSerializer.cs
- CqlWriter.cs
- WorkflowRuntimeElement.cs
- AttachedPropertyMethodSelector.cs
- DependencyPropertyDescriptor.cs
- SByteConverter.cs
- ViewKeyConstraint.cs
- RawStylusInputCustomDataList.cs
- PtsCache.cs
- SQLRoleProvider.cs
- ModelTreeEnumerator.cs
- HandlerFactoryCache.cs
- XPathSelfQuery.cs
- StringSorter.cs
- FieldNameLookup.cs
- EntityKeyElement.cs
- SortFieldComparer.cs
- FaultContractInfo.cs
- xdrvalidator.cs
- DataGridViewCellMouseEventArgs.cs
- OverflowException.cs
- QueueProcessor.cs
- ColumnTypeConverter.cs
- IPAddressCollection.cs
- RSAPKCS1SignatureDeformatter.cs
- HttpGetServerProtocol.cs
- MsmqIntegrationBindingCollectionElement.cs
- RegexCapture.cs
- FeatureAttribute.cs
- DependencyPropertyConverter.cs
- CompensatableTransactionScopeActivity.cs
- CompilerInfo.cs
- GraphicsState.cs
- ColorMap.cs
- DataGridPageChangedEventArgs.cs
- DrawingState.cs
- SqlCommandSet.cs
- CollectionChangeEventArgs.cs
- ExpressionVisitor.cs
- GcHandle.cs
- ConfigUtil.cs
- ThreadExceptionEvent.cs
- DownloadProgressEventArgs.cs
- BufferModeSettings.cs
- PersonalizationProvider.cs
- BamlBinaryReader.cs
- GenericPrincipal.cs
- StoreItemCollection.cs
- CrossContextChannel.cs
- JoinTreeSlot.cs
- UnsafeNetInfoNativeMethods.cs
- CodeNamespaceImportCollection.cs
- ToolTip.cs
- ToolStripTextBox.cs
- OrthographicCamera.cs
- CodeAttributeArgumentCollection.cs
- MessageQueue.cs
- Marshal.cs
- ConfigurationPropertyAttribute.cs
- ListBindableAttribute.cs
- WindowsTooltip.cs
- NoPersistScope.cs
- TypeContext.cs
- EventEntry.cs
- GenericAuthenticationEventArgs.cs
- DataSourceXmlSubItemAttribute.cs
- DocumentGrid.cs
- MatrixTransform3D.cs
- FontNamesConverter.cs
- StaticDataManager.cs
- NativeMethods.cs
- OrderByQueryOptionExpression.cs
- ProviderCommandInfoUtils.cs
- ListViewSelectEventArgs.cs
- RecordBuilder.cs
- IPAddress.cs
- FontFamily.cs
- ConvertTextFrag.cs
- MappingItemCollection.cs
- SafeHandles.cs
- Delegate.cs
- LineBreak.cs
- MembershipUser.cs
- InputLanguageProfileNotifySink.cs
- RecognizeCompletedEventArgs.cs
- BridgeDataRecord.cs
- MethodToken.cs
- GroupJoinQueryOperator.cs
- StylusPointProperty.cs
- NameValuePermission.cs
- MenuEventArgs.cs
- AccessedThroughPropertyAttribute.cs
- PageTheme.cs
- UnsettableComboBox.cs
- MatrixUtil.cs
- SQLDateTimeStorage.cs