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
- XmlSerializationReader.cs
- ValueTypeFixupInfo.cs
- InheritanceUI.cs
- NameValueSectionHandler.cs
- Lease.cs
- MessageSecurityOverMsmqElement.cs
- RtfToXamlLexer.cs
- SqlClientPermission.cs
- ControlOperationInvoker.cs
- HttpStreamFormatter.cs
- DataGridTextColumn.cs
- SessionPageStateSection.cs
- DetailsViewUpdateEventArgs.cs
- DragDropHelper.cs
- DynamicDataExtensions.cs
- ThreadInterruptedException.cs
- MembershipValidatePasswordEventArgs.cs
- XmlToDatasetMap.cs
- HtmlMeta.cs
- SafeEventLogWriteHandle.cs
- GeometryGroup.cs
- ViewStateChangedEventArgs.cs
- XmlSchemaChoice.cs
- IdentityManager.cs
- CodeRemoveEventStatement.cs
- RegexCompilationInfo.cs
- HealthMonitoringSectionHelper.cs
- WmfPlaceableFileHeader.cs
- TextEditorMouse.cs
- EncoderFallback.cs
- ApplicationManager.cs
- TextDecoration.cs
- MetadataAssemblyHelper.cs
- LoginView.cs
- HashMembershipCondition.cs
- CircleHotSpot.cs
- LogFlushAsyncResult.cs
- CodeVariableReferenceExpression.cs
- GradientSpreadMethodValidation.cs
- SelectionProcessor.cs
- Region.cs
- Evidence.cs
- ScrollProviderWrapper.cs
- FileDialog_Vista_Interop.cs
- EventLogPropertySelector.cs
- NetStream.cs
- InternalMappingException.cs
- TemplatedMailWebEventProvider.cs
- SqlDelegatedTransaction.cs
- CodeTypeOfExpression.cs
- QilInvokeLateBound.cs
- RestHandler.cs
- Queue.cs
- View.cs
- TaiwanLunisolarCalendar.cs
- RelationshipWrapper.cs
- ToolStripItemBehavior.cs
- FocusManager.cs
- SingleAnimationBase.cs
- RowToFieldTransformer.cs
- GCHandleCookieTable.cs
- Encoding.cs
- DateTimeConverter2.cs
- PolyQuadraticBezierSegment.cs
- DateTimeFormat.cs
- CatalogPart.cs
- PlaceHolder.cs
- WebPartUserCapability.cs
- SegmentInfo.cs
- ResourceExpressionBuilder.cs
- BitmapEffect.cs
- FormViewDeleteEventArgs.cs
- BitmapEffectGeneralTransform.cs
- BulletedListDesigner.cs
- ApplicationBuildProvider.cs
- FolderBrowserDialogDesigner.cs
- AppDomainAttributes.cs
- Helper.cs
- SapiRecoInterop.cs
- RSAPKCS1SignatureDeformatter.cs
- AndMessageFilter.cs
- unitconverter.cs
- SocketPermission.cs
- DataObjectSettingDataEventArgs.cs
- PhysicalAddress.cs
- DSASignatureDeformatter.cs
- SelectionUIService.cs
- Panel.cs
- _NegoStream.cs
- MimeParameters.cs
- DocumentPageTextView.cs
- ScriptIgnoreAttribute.cs
- ManipulationCompletedEventArgs.cs
- Compiler.cs
- ToolStripScrollButton.cs
- StatusBar.cs
- ReservationCollection.cs
- XmlComment.cs
- IgnoreSectionHandler.cs
- WindowsGraphics.cs