Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / SMSvcHost / System / ServiceModel / Activation / ActivationService.cs / 1 / ActivationService.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Activation { using System; using System.Diagnostics; using System.ServiceProcess; using System.ServiceModel; using System.ServiceModel.Diagnostics; using System.ServiceModel.Activation.Diagnostics; using System.ServiceModel.Channels; using System.Threading; abstract class ActivationService : ServiceBase, IActivationService { ListenerAdapter listenerAdapter; string protocolName; bool isPaused; protected ActivationService(string serviceName, string protocolName) { this.protocolName = protocolName; ServiceName = serviceName; CanHandlePowerEvent = false; AutoLog = false; CanStop = true; CanPauseAndContinue = true; CanShutdown = true; } public bool IsPaused { get { return isPaused; } } public string ActivationServiceName { get { return this.ServiceName; } } public string ProtocolName { get { return protocolName; } } public IActivatedMessageQueue CreateQueue(ListenerAdapter la, App app) { return new ActivatedMessageQueue(la, app); } public IActivatedMessageQueue FindQueue(int queueId) { return ActivatedMessageQueue.Find(queueId); } protected override void OnContinue() { if (DiagnosticUtility.ShouldTraceInformation) { ListenerTraceUtility.TraceEvent(TraceEventType.Information, TraceCode.ServiceContinue, this); } isPaused = false; } protected override void OnPause() { if (DiagnosticUtility.ShouldTraceInformation) { ListenerTraceUtility.TraceEvent(TraceEventType.Information, TraceCode.ServicePause, this); } isPaused = true; } protected override void OnShutdown() { if (DiagnosticUtility.ShouldTraceInformation) { ListenerTraceUtility.TraceEvent(TraceEventType.Information, TraceCode.ServiceShutdown, this); } Shutdown(); Stop(); } protected override void OnStop() { if (DiagnosticUtility.ShouldTraceInformation) { ListenerTraceUtility.TraceEvent(TraceEventType.Information, TraceCode.ServiceStop, this); } Shutdown(); } protected override void OnStart(string[] args) { if (DiagnosticUtility.ShouldTraceInformation) { ListenerTraceUtility.TraceEvent(TraceEventType.Information, TraceCode.ServiceStart, this); } #if DEBUG if (DebuggableService.DelayStart(ServiceName)) { (new Thread(new ThreadStart(Start))).Start(); return; } #endif Start(); } void Start() { #if DEBUG DebuggableService.WaitForDebugger(ServiceName); #endif if (!SMSvcHost.IsWebhostSupported) { const int ERROR_NOT_SUPPORTED = 50; this.ExitCode = ERROR_NOT_SUPPORTED; throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.ServiceRequiresWas))); } isPaused = false; listenerAdapter = new ListenerAdapter(this); listenerAdapter.Open(); } void Shutdown() { listenerAdapter.Close(); } public void StopService() { Stop(); } } } // 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
- UTF32Encoding.cs
- _NegoStream.cs
- XmlTextEncoder.cs
- CoTaskMemHandle.cs
- XmlSchemaAnyAttribute.cs
- HashStream.cs
- SoapCodeExporter.cs
- GridViewRow.cs
- TreeIterator.cs
- DrawingContextFlattener.cs
- UnitySerializationHolder.cs
- EventMappingSettings.cs
- ForwardPositionQuery.cs
- MemberHolder.cs
- DrawingVisualDrawingContext.cs
- WebConvert.cs
- GeometryModel3D.cs
- WindowsComboBox.cs
- SelfIssuedAuthAsymmetricKey.cs
- EndpointDiscoveryMetadataCD1.cs
- HideDisabledControlAdapter.cs
- ImportedNamespaceContextItem.cs
- COAUTHINFO.cs
- _WinHttpWebProxyDataBuilder.cs
- FontCollection.cs
- LogSwitch.cs
- _RequestCacheProtocol.cs
- XmlILConstructAnalyzer.cs
- SoapSchemaMember.cs
- CodeMethodReturnStatement.cs
- ZipIOExtraFieldPaddingElement.cs
- EntryPointNotFoundException.cs
- RepeatBehaviorConverter.cs
- SizeChangedInfo.cs
- QilDataSource.cs
- DoubleLinkList.cs
- NotSupportedException.cs
- EventHandlerList.cs
- UIElement3DAutomationPeer.cs
- CollectionBase.cs
- ObjectStateManagerMetadata.cs
- SignatureToken.cs
- PlacementWorkspace.cs
- ZoneButton.cs
- XmlElementCollection.cs
- SystemEvents.cs
- ToolboxCategoryItems.cs
- TextElementEditingBehaviorAttribute.cs
- CLRBindingWorker.cs
- SecurityDocument.cs
- XdrBuilder.cs
- DateTimeUtil.cs
- XmlILIndex.cs
- Imaging.cs
- SynchronousReceiveBehavior.cs
- HtmlUtf8RawTextWriter.cs
- NamespaceQuery.cs
- ProviderIncompatibleException.cs
- ObjectResult.cs
- VersionedStream.cs
- MemberExpression.cs
- TemplateField.cs
- _NativeSSPI.cs
- ElementAction.cs
- ValidatingReaderNodeData.cs
- SqlDataSourceEnumerator.cs
- SqlCacheDependencyDatabase.cs
- DataBoundControlHelper.cs
- FrugalList.cs
- PeerService.cs
- WebPartTracker.cs
- FamilyCollection.cs
- TimeSpan.cs
- DataListItemEventArgs.cs
- MimeReflector.cs
- WebBrowser.cs
- CopyAttributesAction.cs
- DecimalAnimation.cs
- activationcontext.cs
- RangeBase.cs
- TouchEventArgs.cs
- EntityDataSourceChangedEventArgs.cs
- PkcsUtils.cs
- HtmlTextViewAdapter.cs
- DataGridViewRowHeaderCell.cs
- NavigatingCancelEventArgs.cs
- HttpResponse.cs
- CompiledQueryCacheKey.cs
- UiaCoreTypesApi.cs
- OdbcConnectionStringbuilder.cs
- Rect3DValueSerializer.cs
- Menu.cs
- DiagnosticsConfigurationHandler.cs
- IntermediatePolicyValidator.cs
- SplitterPanel.cs
- HostedAspNetEnvironment.cs
- NumericUpDown.cs
- VariantWrapper.cs
- FixedDocumentPaginator.cs
- WebBaseEventKeyComparer.cs