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
- ContentValidator.cs
- ServiceModelSectionGroup.cs
- SplitterEvent.cs
- ClipboardData.cs
- WindowsAltTab.cs
- PageTheme.cs
- DataKey.cs
- DataColumnCollection.cs
- SystemIPv6InterfaceProperties.cs
- Closure.cs
- TextTreeFixupNode.cs
- CustomAttributeBuilder.cs
- SafeNativeMethodsOther.cs
- SafeNativeMethods.cs
- ReflectionUtil.cs
- ToolStripContainer.cs
- GlobalProxySelection.cs
- ContainerVisual.cs
- DrawingVisualDrawingContext.cs
- PTConverter.cs
- ImageMetadata.cs
- SqlMethodCallConverter.cs
- ActivitiesCollection.cs
- IsolationInterop.cs
- MouseEventArgs.cs
- Package.cs
- DependsOnAttribute.cs
- SspiSecurityTokenProvider.cs
- SortKey.cs
- WrappedReader.cs
- ImageDrawing.cs
- BamlRecordReader.cs
- XmlSyndicationContent.cs
- PropertyStore.cs
- FontNamesConverter.cs
- XmlToDatasetMap.cs
- HttpConfigurationContext.cs
- ChildTable.cs
- BindingMAnagerBase.cs
- EntityDataSourceContainerNameItem.cs
- MembershipValidatePasswordEventArgs.cs
- InkCanvasAutomationPeer.cs
- TraceSection.cs
- ThemeDirectoryCompiler.cs
- DetailsViewPagerRow.cs
- OleDbException.cs
- SwitchExpression.cs
- TreeView.cs
- DbConnectionHelper.cs
- SkipQueryOptionExpression.cs
- AppSettingsReader.cs
- XmlDataLoader.cs
- DataGridPagerStyle.cs
- HMACSHA1.cs
- RuntimeCompatibilityAttribute.cs
- ColumnHeaderConverter.cs
- WindowsFont.cs
- SerialStream.cs
- MsmqChannelFactory.cs
- FilterableData.cs
- PageContentCollection.cs
- WebPartDeleteVerb.cs
- FormsAuthenticationEventArgs.cs
- WCFServiceClientProxyGenerator.cs
- TextCompositionManager.cs
- IncrementalReadDecoders.cs
- IdnMapping.cs
- BevelBitmapEffect.cs
- MatrixAnimationBase.cs
- Utility.cs
- CssTextWriter.cs
- Page.cs
- SecureStringHasher.cs
- PictureBox.cs
- Validator.cs
- CompilerGeneratedAttribute.cs
- XmlEncoding.cs
- Behavior.cs
- ReferencedCollectionType.cs
- SemanticKeyElement.cs
- BufferModeSettings.cs
- ToolStripDropDownClosedEventArgs.cs
- HashMembershipCondition.cs
- OverflowException.cs
- VersionValidator.cs
- SqlParameter.cs
- InfoCardSymmetricCrypto.cs
- SymbolMethod.cs
- ImageListDesigner.cs
- TemplateField.cs
- SoapExtensionReflector.cs
- ReliableMessagingVersionConverter.cs
- XmlEncoding.cs
- DataTableCollection.cs
- QuaternionRotation3D.cs
- SharedRuntimeState.cs
- PlaceHolder.cs
- LineVisual.cs
- PolyQuadraticBezierSegment.cs
- formatter.cs