Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / SMSvcHost / System / ServiceModel / Activation / ListenerConfig.cs / 1 / ListenerConfig.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Activation
{
using System.Collections.Generic;
using System.Security.Principal;
using System.Configuration;
using System.Diagnostics;
using System.ServiceModel.Diagnostics;
using System.ServiceModel.Activation.Configuration;
static class ListenerConfig
{
static object syncRoot = new object();
static NetTcpSectionData tcpData = null;
static NetPipeSectionData pipeData = null;
static bool diagnosticsSectionInited = false;
static bool perfCountersEnabled = false;
static object SyncRoot
{
get
{
return syncRoot;
}
}
static void EnsureInitializedForDiagnostics()
{
if (!diagnosticsSectionInited)
{
lock (SyncRoot)
{
if (!diagnosticsSectionInited)
{
DiagnosticSection diag = DiagnosticSection.GetSection();
perfCountersEnabled = diag.PerformanceCountersEnabled;
diagnosticsSectionInited = true;
}
}
}
}
public static void EnsureInitializedForNetTcp()
{
EnsureInitializedForDiagnostics();
if (tcpData == null)
{
lock (SyncRoot)
{
if (tcpData == null)
{
tcpData = new NetTcpSectionData();
}
}
}
if (DiagnosticUtility.ShouldTraceInformation)
{
DiagnosticUtility.DiagnosticTrace.TraceEvent(TraceEventType.Information, TraceCode.ReadNetTcpConfig,
SR.GetString(SR.TraceCodeReadNetTcpConfig, tcpData.ListenBacklog, tcpData.MaxPendingConnections,
tcpData.MaxPendingAccepts, tcpData.ReceiveTimeout, tcpData.TeredoEnabled));
}
}
public static void EnsureInitializedForNetPipe()
{
EnsureInitializedForDiagnostics();
if (pipeData == null)
{
lock (SyncRoot)
{
if (pipeData == null)
{
pipeData = new NetPipeSectionData();
}
}
}
if (DiagnosticUtility.ShouldTraceInformation)
{
DiagnosticUtility.DiagnosticTrace.TraceEvent(TraceEventType.Information, TraceCode.ReadNetPipeConfig,
SR.GetString(SR.TraceCodeReadNetPipeConfig, pipeData.MaxPendingConnections, pipeData.MaxPendingAccepts, pipeData.ReceiveTimeout));
}
}
public static NetTcpSectionData NetTcp
{
get
{
EnsureInitializedForNetTcp();
return tcpData;
}
}
public static NetPipeSectionData NetPipe
{
get
{
EnsureInitializedForNetPipe();
return pipeData;
}
}
public static bool PerformanceCountersEnabled
{
get
{
EnsureInitializedForDiagnostics();
return perfCountersEnabled;
}
}
public static List GetAllowAccounts(TransportType transportType)
{
if (transportType == TransportType.Tcp)
{
if (NetTcp.AllowAccounts.Count == 0)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
SR.GetString(SR.ConfigSectionHasZeroAllowAccounts, "NetTcpSection")));
}
return NetTcp.AllowAccounts;
}
else if (transportType == TransportType.NamedPipe)
{
if (NetPipe.AllowAccounts.Count == 0)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
SR.GetString(SR.ConfigSectionHasZeroAllowAccounts, "NetPipeSection")));
}
return NetPipe.AllowAccounts;
}
return null;
}
}
}
// 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
- ExceptionHelpers.cs
- PopupEventArgs.cs
- StorageInfo.cs
- StringFreezingAttribute.cs
- SafeHandle.cs
- VoiceInfo.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- AttributeCollection.cs
- Formatter.cs
- CalendarDay.cs
- DocumentSequence.cs
- ServicePointManagerElement.cs
- CommandLibraryHelper.cs
- AppDomainUnloadedException.cs
- DataGridViewRowConverter.cs
- TextDocumentView.cs
- DataServiceResponse.cs
- ContainerControl.cs
- _SingleItemRequestCache.cs
- TemplateBuilder.cs
- TerminatorSinks.cs
- ErrorStyle.cs
- BezierSegment.cs
- DBParameter.cs
- SiteMembershipCondition.cs
- DbConnectionStringCommon.cs
- GridViewCancelEditEventArgs.cs
- AspProxy.cs
- MatrixIndependentAnimationStorage.cs
- ImpersonateTokenRef.cs
- controlskin.cs
- DataControlCommands.cs
- LifetimeManager.cs
- Pair.cs
- TextTreeNode.cs
- SharedHttpsTransportManager.cs
- XAMLParseException.cs
- OpenTypeMethods.cs
- PluralizationService.cs
- util.cs
- BufferModeSettings.cs
- CodeThrowExceptionStatement.cs
- WebPartConnectionsConfigureVerb.cs
- SchemaName.cs
- dataobject.cs
- HtmlInputReset.cs
- MaskInputRejectedEventArgs.cs
- ApplicationCommands.cs
- HttpApplication.cs
- InputReportEventArgs.cs
- SemaphoreSecurity.cs
- DependencyPropertyKey.cs
- dataprotectionpermission.cs
- ConfigurationPropertyAttribute.cs
- PeerNameRecordCollection.cs
- ClientType.cs
- DataGrid.cs
- StackSpiller.Generated.cs
- WebHttpElement.cs
- Thumb.cs
- SystemShuttingDownException.cs
- TransactionFlowAttribute.cs
- UnmanagedMemoryStreamWrapper.cs
- KeyValueConfigurationElement.cs
- ScriptServiceAttribute.cs
- DocumentXmlWriter.cs
- ProviderIncompatibleException.cs
- MsmqIntegrationProcessProtocolHandler.cs
- PartialToken.cs
- Link.cs
- IODescriptionAttribute.cs
- DataBinder.cs
- TableRow.cs
- StateMachineExecutionState.cs
- JoinTreeSlot.cs
- RuntimeArgumentHandle.cs
- X509Certificate.cs
- MemberHolder.cs
- AdapterDictionary.cs
- Encoder.cs
- FormsAuthentication.cs
- SettingsPropertyWrongTypeException.cs
- BitmapEncoder.cs
- WebPartAddingEventArgs.cs
- IntSecurity.cs
- FixedPageStructure.cs
- SoapObjectWriter.cs
- PropertyGrid.cs
- ServiceModelReg.cs
- XmlChildEnumerator.cs
- FakeModelItemImpl.cs
- SoapExtensionImporter.cs
- TypeGeneratedEventArgs.cs
- _SafeNetHandles.cs
- WebPartDisplayModeEventArgs.cs
- Command.cs
- WebBrowserProgressChangedEventHandler.cs
- Int32CAMarshaler.cs
- ConstructorArgumentAttribute.cs
- Cursors.cs