Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Activation / HttpHostedTransportConfiguration.cs / 1 / HttpHostedTransportConfiguration.cs
//---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------------------- namespace System.ServiceModel.Activation { using System.Collections; using System.ServiceModel; using System.ServiceModel.Channels; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.Net; using System.Security; class HttpHostedTransportConfiguration : HostedTransportConfigurationBase { CollectiontransportManagerDirectory; internal protected HttpHostedTransportConfiguration(string scheme) : base(scheme) { CreateTransportManagers(); } internal HttpHostedTransportConfiguration() : this(Uri.UriSchemeHttp) {} HostedHttpTransportManager CreateTransportManager(BaseUriWithWildcard listenAddress) { UriPrefixTable table = null; if (object.ReferenceEquals(this.Scheme, Uri.UriSchemeHttp)) { table = HttpChannelListener.StaticTransportManagerTable; } else { table = SharedHttpsTransportManager.StaticTransportManagerTable; } HostedHttpTransportManager httpManager = null; lock (table) { ITransportManagerRegistration registration; if (!table.TryLookupUri(listenAddress.BaseAddress, listenAddress.HostNameComparisonMode, out registration)) { httpManager = new HostedHttpTransportManager(listenAddress); table.RegisterUri(listenAddress.BaseAddress, listenAddress.HostNameComparisonMode, httpManager); } } return httpManager; } void CreateTransportManagers() { Collection tempDirectory = new Collection (); string[] bindings = HostedTransportConfigurationManager.MetabaseSettings.GetBindings(this.Scheme); foreach (string binding in bindings) { TryDebugPrint("HttpHostedTransportConfiguration.CreateTransportManagers() adding binding: " + binding); BaseUriWithWildcard listenAddress = null; if (object.ReferenceEquals(this.Scheme, Uri.UriSchemeHttp)) { listenAddress = BaseUriWithWildcard.CreateHttpUri(binding); } else { listenAddress = BaseUriWithWildcard.CreateHttpsUri(binding); } HostedHttpTransportManager httpManager = CreateTransportManager(listenAddress); if (httpManager != null) { tempDirectory.Add(httpManager); ListenAddresses.Add(listenAddress); } } transportManagerDirectory = tempDirectory; } static bool canDebugPrint = true; [Conditional("DEBUG")] static void TryDebugPrint(string message) { if (canDebugPrint) { try { Debug.Print(message); } catch (SecurityException e) { canDebugPrint = false; // not re-throwing on purpose if (DiagnosticUtility.ShouldTraceWarning) { DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); } } } } internal HostedHttpTransportManager GetHttpTransportManager(Uri uri) { HostedHttpTransportManager foundTransportManager = null; HostedHttpTransportManager weakTransportManager = null; foreach (HostedHttpTransportManager manager in transportManagerDirectory) { if ((string.Compare(manager.Scheme, uri.Scheme, StringComparison.OrdinalIgnoreCase) == 0) && (manager.ListenUri.Port == uri.Port)) { if (manager.HostNameComparisonMode == HostNameComparisonMode.StrongWildcard) { return manager; } if (manager.HostNameComparisonMode == HostNameComparisonMode.WeakWildcard) { weakTransportManager = manager; } if ((manager.HostNameComparisonMode == HostNameComparisonMode.Exact) && (string.Compare(manager.ListenUri.Host, uri.Host, StringComparison.OrdinalIgnoreCase) == 0)) { foundTransportManager = manager; } } } if (foundTransportManager == null) foundTransportManager = weakTransportManager; return foundTransportManager; } public override Uri[] GetBaseAddresses(string virtualPath) { // Special casing SSL settings. if (string.CompareOrdinal(this.Scheme, Uri.UriSchemeHttp) == 0 && !ServiceHostingEnvironment.IsSimpleApplicationHost) { if (HostedTransportConfigurationManager.MetabaseSettings.GetAllowSslOnly(virtualPath)) { return new Uri[0]; } } return base.GetBaseAddresses(virtualPath); } } } // 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
- ContainerVisual.cs
- HtmlSelectionListAdapter.cs
- UnknownBitmapEncoder.cs
- StructuralComparisons.cs
- BlurEffect.cs
- InboundActivityHelper.cs
- DataGridClipboardCellContent.cs
- PublisherMembershipCondition.cs
- SecurityManager.cs
- XmlSchemaParticle.cs
- WebResourceAttribute.cs
- MSAAEventDispatcher.cs
- CompositeFontInfo.cs
- UriSectionData.cs
- hresults.cs
- PhysicalOps.cs
- TableCellCollection.cs
- GridViewRowPresenter.cs
- ToolboxItem.cs
- WebException.cs
- WorkflowInstance.cs
- HttpRequestWrapper.cs
- DragStartedEventArgs.cs
- SelectedPathEditor.cs
- ConfigurationLocationCollection.cs
- ClassicBorderDecorator.cs
- TagMapCollection.cs
- EventSetter.cs
- Mappings.cs
- TypeListConverter.cs
- AdRotator.cs
- PropertyMappingExceptionEventArgs.cs
- LinkUtilities.cs
- ProfileInfo.cs
- ProviderUtil.cs
- Viewport3DAutomationPeer.cs
- SerializationObjectManager.cs
- DynamicValidatorEventArgs.cs
- PackUriHelper.cs
- ViewManager.cs
- TileBrush.cs
- ErrorWrapper.cs
- TableLayout.cs
- EdmRelationshipRoleAttribute.cs
- RectValueSerializer.cs
- UInt64Storage.cs
- SharingService.cs
- controlskin.cs
- DisplayNameAttribute.cs
- InvalidPrinterException.cs
- WebPartDisplayModeEventArgs.cs
- Accessors.cs
- DataGridViewCellCollection.cs
- FixedSOMImage.cs
- WorkerRequest.cs
- PbrsForward.cs
- DataGridViewRowPostPaintEventArgs.cs
- SafeHandles.cs
- ServiceOperationParameter.cs
- HtmlTableRowCollection.cs
- ItemDragEvent.cs
- DelayedRegex.cs
- TCPClient.cs
- ScrollProviderWrapper.cs
- XmlIgnoreAttribute.cs
- Constraint.cs
- ObjectTag.cs
- IssuedTokenParametersElement.cs
- WebPartZoneBaseDesigner.cs
- XmlNodeReader.cs
- ParserContext.cs
- XhtmlBasicPanelAdapter.cs
- IsolatedStorageException.cs
- ReflectTypeDescriptionProvider.cs
- DriveNotFoundException.cs
- DictionarySectionHandler.cs
- Expression.cs
- XPathEmptyIterator.cs
- LineUtil.cs
- DataGridHyperlinkColumn.cs
- Compress.cs
- HttpListenerPrefixCollection.cs
- XmlSchemaSimpleContent.cs
- ObjectDataSourceDisposingEventArgs.cs
- DBConnectionString.cs
- CookieParameter.cs
- loginstatus.cs
- ControlUtil.cs
- MobileRedirect.cs
- MergeFailedEvent.cs
- SuppressMessageAttribute.cs
- OSFeature.cs
- XmlNullResolver.cs
- StringSource.cs
- ArgumentOutOfRangeException.cs
- RemotingConfiguration.cs
- ObjectHelper.cs
- ServiceReference.cs
- RawKeyboardInputReport.cs
- DbProviderServices.cs