Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / SMSvcHost / System / ServiceModel / Activation / NamedPipeWorkerProcess.cs / 1 / NamedPipeWorkerProcess.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Activation
{
using System;
using System.Diagnostics;
using System.Globalization;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Diagnostics;
using System.ServiceModel.Activation.Diagnostics;
using EventLogCategory = System.ServiceModel.Diagnostics.EventLogCategory;
using EventLogEventId = System.ServiceModel.Diagnostics.EventLogEventId;
class NamedPipeWorkerProcess : WorkerProcess
{
protected override DuplicateContext DuplicateConnection(ListenerSessionConnection session)
{
bool success = false;
IntPtr dupedPipe = IntPtr.Zero;
try
{
dupedPipe = (IntPtr)session.Connection.DuplicateAndClose(this.ProcessId);
success = true;
}
#pragma warning suppress 56500 // covered by FxCOP
catch (Exception exception)
{
if (DiagnosticUtility.IsFatal(exception))
{
throw;
}
// this normally happens if:
// A) we don't have rights to duplicate handles to the WorkerProcess NativeErrorCode == 87
// B) we fail to duplicate handle because the WorkerProcess is exiting/exited NativeErrorCode == ???
// - in the self hosted case: report error to the client
// - in the web hosted case: roundrobin to the next available WorkerProcess (if this WorkerProcess is down?)
#if DEBUG
if (exception is CommunicationException)
{
int errorCode = ((System.IO.PipeException)exception.InnerException).ErrorCode;
Debug.Print("NamedPipeWorkerProcess.DuplicateConnection() failed duplicating pipe for processId: " + this.ProcessId + " errorCode:" + errorCode + " exception:" + exception.Message);
}
#endif
if (DiagnosticUtility.ShouldTraceError)
{
ListenerTraceUtility.TraceEvent(TraceEventType.Error, TraceCode.MessageQueueDuplicatedPipe, this, exception);
}
}
if (success)
{
if (DiagnosticUtility.ShouldTraceInformation)
{
ListenerTraceUtility.TraceEvent(TraceEventType.Information, TraceCode.MessageQueueDuplicatedPipe, this);
}
return new NamedPipeDuplicateContext(dupedPipe, session.Via, session.Data);
}
return null;
}
protected override void OnDispatchSuccess()
{
ListenerPerfCounters.IncrementConnectionsDispatchedNamedPipe();
}
protected override TransportType TransportType
{
get
{
return TransportType.NamedPipe;
}
}
}
}
// 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
- CodeIdentifier.cs
- SystemUdpStatistics.cs
- WebPartCatalogCloseVerb.cs
- AnonymousIdentificationModule.cs
- AssemblyInfo.cs
- Focus.cs
- MimeObjectFactory.cs
- PocoEntityKeyStrategy.cs
- PaintEvent.cs
- SharedUtils.cs
- SqlInternalConnectionTds.cs
- PageAsyncTaskManager.cs
- XmlILIndex.cs
- LocalizeDesigner.cs
- ButtonBase.cs
- HwndSourceParameters.cs
- TagPrefixAttribute.cs
- CodeMethodInvokeExpression.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- SafeUserTokenHandle.cs
- HttpTransportManager.cs
- ContainerSelectorActiveEvent.cs
- ProjectionCamera.cs
- TreeNodeCollection.cs
- SystemDiagnosticsSection.cs
- ServicePoint.cs
- MimeMapping.cs
- ByeOperationCD1AsyncResult.cs
- PropertyIDSet.cs
- AssemblyUtil.cs
- SettingsSection.cs
- DrawingGroup.cs
- IOException.cs
- TiffBitmapDecoder.cs
- WorkflowDefinitionDispenser.cs
- FixedElement.cs
- EntityKey.cs
- SafeEventLogReadHandle.cs
- UnsafeNativeMethods.cs
- RequestQueue.cs
- DbConnectionPoolIdentity.cs
- WindowsListViewScroll.cs
- EntitySqlException.cs
- EventHandlers.cs
- Part.cs
- CookieProtection.cs
- DoubleConverter.cs
- SoapExtensionTypeElement.cs
- Catch.cs
- SplineKeyFrames.cs
- DataListItem.cs
- CollectionType.cs
- SafeNativeMemoryHandle.cs
- XmlLanguageConverter.cs
- IPCCacheManager.cs
- TextProperties.cs
- StorageEndPropertyMapping.cs
- DiscoveryDocumentLinksPattern.cs
- ContainerCodeDomSerializer.cs
- Point.cs
- SqlCommandSet.cs
- DropDownList.cs
- safex509handles.cs
- DeclarativeCatalogPartDesigner.cs
- OracleLob.cs
- ellipse.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- DataGridViewTextBoxCell.cs
- SelectionHighlightInfo.cs
- SyndicationSerializer.cs
- MsmqMessage.cs
- URLString.cs
- MessageQueueConverter.cs
- FlowDocumentScrollViewer.cs
- RequiredFieldValidator.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- TextEndOfLine.cs
- SafeTimerHandle.cs
- QilSortKey.cs
- SmtpNetworkElement.cs
- Metafile.cs
- BitmapEffectDrawing.cs
- ImportException.cs
- IgnorePropertiesAttribute.cs
- UnsafePeerToPeerMethods.cs
- SchemaSetCompiler.cs
- IIS7UserPrincipal.cs
- DrawingGroup.cs
- FormatSettings.cs
- DBSchemaTable.cs
- LogRestartAreaEnumerator.cs
- Membership.cs
- DrawingBrush.cs
- BinaryObjectWriter.cs
- QueryStringParameter.cs
- OdbcConnectionHandle.cs
- ItemCollection.cs
- IntegerFacetDescriptionElement.cs
- DbConvert.cs
- WebPartVerb.cs