Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / WasHosting / System / ServiceModel / WasHosting / BaseProcessProtocolHandler.cs / 1 / BaseProcessProtocolHandler.cs
//---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------------------- namespace System.ServiceModel.WasHosting { using System; using System.Collections.Generic; using System.Diagnostics; using System.ServiceModel; using System.Web; using System.Web.Hosting; using System.ServiceModel.Channels; using System.ServiceModel.Activation; abstract class BaseProcessProtocolHandler : ProcessProtocolHandler { string protocolId; IAdphManager adphManager; // Mapping from listenerChannelId->listenerChannelContext (i.e. IAdphManager, appId) DictionarylistenerChannelIdMapping = new Dictionary (); protected BaseProcessProtocolHandler(string protocolId) : base() { this.protocolId = protocolId; } internal virtual void HandleStartListenerChannelError(IListenerChannelCallback listenerChannelCallback, Exception ex) { // This is the workaround to let WAS know that the LC is started and then gracefully stopped. listenerChannelCallback.ReportStarted(); listenerChannelCallback.ReportStopped(0); } // Start per-process listening for messages public override void StartListenerChannel(IListenerChannelCallback listenerChannelCallback, IAdphManager adphManager) { DiagnosticUtility.DebugAssert(listenerChannelCallback != null, "The listenerChannelCallback parameter must not be null"); DiagnosticUtility.DebugAssert(adphManager != null, "The adphManager parameter must not be null"); int channelId = listenerChannelCallback.GetId(); ListenerChannelContext listenerChannelContext; lock (this.listenerChannelIdMapping) { if (!listenerChannelIdMapping.TryGetValue(channelId, out listenerChannelContext)) { int listenerChannelDataLength = listenerChannelCallback.GetBlobLength(); byte[] listenerChannelData = new byte[listenerChannelDataLength]; listenerChannelCallback.GetBlob(listenerChannelData, ref listenerChannelDataLength); Debug.Print("BaseProcessProtocolHandler.StartListenerChannel() GetBlob() contains " + listenerChannelDataLength + " bytes"); listenerChannelContext = ListenerChannelContext.Hydrate(listenerChannelData); this.listenerChannelIdMapping.Add(channelId, listenerChannelContext); Debug.Print("BaseProcessProtocolHandler.StartListenerChannel() listenerChannelContext.ListenerChannelId: " + listenerChannelContext.ListenerChannelId); } } if (this.adphManager == null) { this.adphManager = adphManager; } try { // wether or not a previous AppDomain was running, we're going to start a new one now: Debug.Print("BaseProcessProtocolHandler.StartListenerChannel() calling StartAppDomainProtocolListenerChannel(appKey:" + listenerChannelContext.AppKey + " protocolId:" + protocolId + ")"); adphManager.StartAppDomainProtocolListenerChannel(listenerChannelContext.AppKey, protocolId, listenerChannelCallback); } catch (Exception ex) { if (DiagnosticUtility.IsFatal(ex)) { throw; } if (DiagnosticUtility.ShouldTraceError) { DiagnosticUtility.ExceptionUtility.TraceHandledException(ex, TraceEventType.Error); } HandleStartListenerChannelError(listenerChannelCallback, ex); } } public override void StopProtocol(bool immediate) { Debug.Print("BaseProcessProtocolHandler.StopProtocol(protocolId:" + protocolId + ", immediate:" + immediate + ")"); } public override void StopListenerChannel(int listenerChannelId, bool immediate) { Debug.Print("BaseProcessProtocolHandler.StopListenerChannel(protocolId:" + protocolId + ", listenerChannelId:" + listenerChannelId + ", immediate:" + immediate + ")"); ListenerChannelContext listenerChannelContext = this.listenerChannelIdMapping[listenerChannelId]; adphManager.StopAppDomainProtocolListenerChannel(listenerChannelContext.AppKey, protocolId, listenerChannelId, immediate); lock (this.listenerChannelIdMapping) { // Remove the channel id. this.listenerChannelIdMapping.Remove(listenerChannelId); } } } } // 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
- _UriSyntax.cs
- ObjectDataSource.cs
- ThreadInterruptedException.cs
- PersonalizableTypeEntry.cs
- ToolStripPanelCell.cs
- DBConnection.cs
- EpmSyndicationContentSerializer.cs
- SmiEventSink_DeferedProcessing.cs
- DecoderFallbackWithFailureFlag.cs
- PolyQuadraticBezierSegment.cs
- shaperfactory.cs
- PageTheme.cs
- URLAttribute.cs
- ColorConverter.cs
- TextRangeSerialization.cs
- TargetControlTypeCache.cs
- StorageTypeMapping.cs
- PropertyGridEditorPart.cs
- NativeMethods.cs
- DrawingDrawingContext.cs
- EventLogPermissionEntryCollection.cs
- UnaryNode.cs
- MissingSatelliteAssemblyException.cs
- QueueAccessMode.cs
- SystemNetHelpers.cs
- SignatureToken.cs
- DirtyTextRange.cs
- Composition.cs
- TemplateColumn.cs
- TextTreeRootNode.cs
- IIS7UserPrincipal.cs
- _UriSyntax.cs
- CellIdBoolean.cs
- GridViewSelectEventArgs.cs
- OdbcParameter.cs
- ObjectItemNoOpAssemblyLoader.cs
- WindowsToolbar.cs
- EndPoint.cs
- XmlSerializerFactory.cs
- WbmpConverter.cs
- ManualResetEvent.cs
- PageAsyncTaskManager.cs
- MimeMapping.cs
- IProducerConsumerCollection.cs
- OleDbDataReader.cs
- TemplateParser.cs
- GeometryModel3D.cs
- WebRequest.cs
- IDQuery.cs
- ControlBuilder.cs
- ManualResetEvent.cs
- PropertyPathConverter.cs
- MarshalDirectiveException.cs
- PointConverter.cs
- DataObjectPastingEventArgs.cs
- ComplexType.cs
- ItemChangedEventArgs.cs
- XmlAutoDetectWriter.cs
- Util.cs
- XmlSchemaIdentityConstraint.cs
- DesignerActionVerbItem.cs
- RequestNavigateEventArgs.cs
- SessionStateContainer.cs
- XsltSettings.cs
- FixedTextSelectionProcessor.cs
- WorkflowServiceBuildProvider.cs
- FrameDimension.cs
- ActivityDesignerResources.cs
- ClientRoleProvider.cs
- HandlerFactoryCache.cs
- BaseTreeIterator.cs
- ActivityDesignerHelper.cs
- HeaderedContentControl.cs
- _ShellExpression.cs
- WebPartEditorApplyVerb.cs
- SiteMapSection.cs
- EdmFunctionAttribute.cs
- LocatorBase.cs
- GreenMethods.cs
- StatusBarPanel.cs
- OperationFormatStyle.cs
- PersonalizableTypeEntry.cs
- DSACryptoServiceProvider.cs
- DriveNotFoundException.cs
- BindingSource.cs
- MiniCustomAttributeInfo.cs
- XslNumber.cs
- DataGridViewTextBoxCell.cs
- InternalBase.cs
- Win32Exception.cs
- ReachVisualSerializer.cs
- ReturnEventArgs.cs
- SRDisplayNameAttribute.cs
- DatePickerDateValidationErrorEventArgs.cs
- AdjustableArrowCap.cs
- CopyAttributesAction.cs
- WebMessageFormatHelper.cs
- RunWorkerCompletedEventArgs.cs
- SimpleTypeResolver.cs
- ServiceContractListItemList.cs