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
- ReferencedType.cs
- RadioButton.cs
- UTF32Encoding.cs
- DataControlFieldCell.cs
- CallbackValidator.cs
- ResourceType.cs
- SamlAssertionKeyIdentifierClause.cs
- X509CertificateClaimSet.cs
- BlockCollection.cs
- SctClaimDictionary.cs
- CodeMemberProperty.cs
- TreeView.cs
- SafeSystemMetrics.cs
- HandlerMappingMemo.cs
- XmlSortKeyAccumulator.cs
- Transform.cs
- BamlLocalizableResource.cs
- ThreadStaticAttribute.cs
- ToolStripSeparatorRenderEventArgs.cs
- SqlDataSourceStatusEventArgs.cs
- CollectionChange.cs
- RequestContext.cs
- PathNode.cs
- ThreadStaticAttribute.cs
- StylusPointPropertyInfo.cs
- TreeViewImageKeyConverter.cs
- ToolboxItemFilterAttribute.cs
- ContextQuery.cs
- MaskDescriptors.cs
- PageThemeBuildProvider.cs
- ConfigXmlText.cs
- ConfigXmlDocument.cs
- GeneralTransform3D.cs
- XsdBuilder.cs
- TreeViewImageKeyConverter.cs
- AlphabetConverter.cs
- HtmlControl.cs
- ExpressionLexer.cs
- SqlCommandSet.cs
- RtfToken.cs
- WriteTimeStream.cs
- InputLanguageSource.cs
- COM2ExtendedBrowsingHandler.cs
- MimeObjectFactory.cs
- VectorValueSerializer.cs
- HttpCacheParams.cs
- DbParameterCollectionHelper.cs
- ServiceEndpointCollection.cs
- Stylesheet.cs
- ToolStripManager.cs
- ProxyHwnd.cs
- TraceProvider.cs
- MenuItemCollection.cs
- CollectionChangeEventArgs.cs
- DesignerActionKeyboardBehavior.cs
- OAVariantLib.cs
- CodeAssignStatement.cs
- Ray3DHitTestResult.cs
- ThreadSafeList.cs
- DbMetaDataColumnNames.cs
- FontFaceLayoutInfo.cs
- TextSelectionHighlightLayer.cs
- GroupBoxRenderer.cs
- DefaultBinder.cs
- ToolStrip.cs
- SqlNodeAnnotation.cs
- BoundColumn.cs
- AlternateViewCollection.cs
- GlyphRunDrawing.cs
- WebServiceParameterData.cs
- ReferenceConverter.cs
- ViewKeyConstraint.cs
- mediapermission.cs
- DecimalConstantAttribute.cs
- RemotingConfiguration.cs
- BinaryConverter.cs
- DropShadowEffect.cs
- SemanticKeyElement.cs
- WebControlToolBoxItem.cs
- X509ThumbprintKeyIdentifierClause.cs
- ShaderEffect.cs
- bindurihelper.cs
- AppSettingsExpressionBuilder.cs
- BooleanToVisibilityConverter.cs
- StrokeFIndices.cs
- ListManagerBindingsCollection.cs
- MarkupProperty.cs
- MimeMultiPart.cs
- CachedTypeface.cs
- WindowsStatic.cs
- Stylesheet.cs
- UIElementAutomationPeer.cs
- WbemProvider.cs
- DecimalConstantAttribute.cs
- DesignTimeParseData.cs
- ErrorTableItemStyle.cs
- ErrorTolerantObjectWriter.cs
- SqlStream.cs
- GridViewItemAutomationPeer.cs
- SaveFileDialog.cs