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
- CharAnimationUsingKeyFrames.cs
- CharConverter.cs
- SQLConvert.cs
- DateTimeConstantAttribute.cs
- WsatEtwTraceListener.cs
- _UriSyntax.cs
- Rijndael.cs
- IfAction.cs
- GridView.cs
- BamlCollectionHolder.cs
- CustomError.cs
- AutomationPeer.cs
- Point3DCollectionConverter.cs
- Exceptions.cs
- DataGridViewElement.cs
- TableParaClient.cs
- WebBrowserNavigatingEventHandler.cs
- Cursor.cs
- CollectionView.cs
- WindowsStatusBar.cs
- UIElementParaClient.cs
- DataRecordInfo.cs
- QilVisitor.cs
- FileFormatException.cs
- TimerEventSubscriptionCollection.cs
- WebUtil.cs
- StatusBar.cs
- CodeChecksumPragma.cs
- URL.cs
- DescendantQuery.cs
- OdbcParameterCollection.cs
- PeerReferralPolicy.cs
- CharacterShapingProperties.cs
- CompiledAction.cs
- GenericIdentity.cs
- PasswordRecovery.cs
- Aggregates.cs
- Setter.cs
- GenericPrincipal.cs
- EntityDataSourceDesignerHelper.cs
- WebPartDisplayModeEventArgs.cs
- SortedSetDebugView.cs
- RedistVersionInfo.cs
- StopRoutingHandler.cs
- DataGridCheckBoxColumn.cs
- CreateUserWizard.cs
- FloaterBaseParaClient.cs
- TableParaClient.cs
- ToolBarButtonClickEvent.cs
- BindingSource.cs
- BreadCrumbTextConverter.cs
- WebZone.cs
- WebPartZoneCollection.cs
- DependencyPropertyKey.cs
- Misc.cs
- Sorting.cs
- FacetValues.cs
- BinaryParser.cs
- WebPartPersonalization.cs
- ListViewTableRow.cs
- HTMLTagNameToTypeMapper.cs
- FileDialogCustomPlace.cs
- UniformGrid.cs
- EntityDataSourceDesignerHelper.cs
- M3DUtil.cs
- OracleInfoMessageEventArgs.cs
- OperatorExpressions.cs
- UnsafePeerToPeerMethods.cs
- VariableAction.cs
- MemberRestriction.cs
- FullTextState.cs
- RegexReplacement.cs
- SettingsContext.cs
- SqlDelegatedTransaction.cs
- ReferenceConverter.cs
- FaultHandlingFilter.cs
- FormatException.cs
- IdentitySection.cs
- NullEntityWrapper.cs
- DecoratedNameAttribute.cs
- ListBindingConverter.cs
- Scheduler.cs
- KeyToListMap.cs
- Perspective.cs
- PasswordDeriveBytes.cs
- TemplateParser.cs
- ErrorLog.cs
- SetStoryboardSpeedRatio.cs
- SkipStoryboardToFill.cs
- StaticDataManager.cs
- DependencySource.cs
- CacheDependency.cs
- KeyFrames.cs
- ImageBrush.cs
- SmtpClient.cs
- DoubleSumAggregationOperator.cs
- FileLevelControlBuilderAttribute.cs
- SafeSerializationManager.cs
- PropertyCondition.cs
- SqlProcedureAttribute.cs