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
- Rotation3DKeyFrameCollection.cs
- LinqDataSourceEditData.cs
- CompensatableTransactionScopeActivityDesigner.cs
- OpCellTreeNode.cs
- DataStorage.cs
- AliasedSlot.cs
- TransactionScope.cs
- DefaultValueAttribute.cs
- XPathDocumentNavigator.cs
- DataColumnMapping.cs
- RestHandler.cs
- ImplicitInputBrush.cs
- FileDialog_Vista_Interop.cs
- DbConnectionPool.cs
- XamlPoint3DCollectionSerializer.cs
- ParserExtension.cs
- MenuTracker.cs
- ScriptingProfileServiceSection.cs
- Rule.cs
- RoleServiceManager.cs
- OutputCacheSettingsSection.cs
- TextReader.cs
- sqlpipe.cs
- DynamicMethod.cs
- Int64KeyFrameCollection.cs
- Page.cs
- ImportedNamespaceContextItem.cs
- DataChangedEventManager.cs
- DataGridViewAccessibleObject.cs
- DynamicPropertyReader.cs
- DataFieldEditor.cs
- RegexParser.cs
- StandardOleMarshalObject.cs
- ResourceDisplayNameAttribute.cs
- XmlSchemaInclude.cs
- XmlRawWriterWrapper.cs
- HelloMessageApril2005.cs
- Point4DValueSerializer.cs
- DataContractFormatAttribute.cs
- ObjectStorage.cs
- DataGridItemAutomationPeer.cs
- HtmlTableCellCollection.cs
- MultiSelector.cs
- StylusOverProperty.cs
- Baml2006ReaderFrame.cs
- ThousandthOfEmRealDoubles.cs
- WebConfigurationHost.cs
- Run.cs
- IisTraceListener.cs
- MergeFailedEvent.cs
- InvokeSchedule.cs
- XNodeValidator.cs
- BuilderInfo.cs
- ViewGenerator.cs
- BrowserCapabilitiesFactory.cs
- MessageQueuePermissionEntryCollection.cs
- RadioButtonAutomationPeer.cs
- AppModelKnownContentFactory.cs
- Thumb.cs
- RegexCompilationInfo.cs
- EmptyCollection.cs
- BooleanFunctions.cs
- ListViewItem.cs
- DataDocumentXPathNavigator.cs
- CheckableControlBaseAdapter.cs
- BamlLocalizabilityResolver.cs
- RawStylusInput.cs
- TdsEnums.cs
- ProxyGenerator.cs
- Missing.cs
- ToolStripItemImageRenderEventArgs.cs
- WebPartConnectionsCancelVerb.cs
- PageDeviceFont.cs
- InputScope.cs
- safesecurityhelperavalon.cs
- DesignerToolboxInfo.cs
- ExpressionEvaluator.cs
- ExtensionDataObject.cs
- XmlName.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- XsltException.cs
- Environment.cs
- Perspective.cs
- SortKey.cs
- AttributeQuery.cs
- ExtenderControl.cs
- StringUtil.cs
- AspCompat.cs
- ElementNotAvailableException.cs
- DecoderFallbackWithFailureFlag.cs
- AddInProcess.cs
- SoundPlayerAction.cs
- XmlSchemaType.cs
- BindingMAnagerBase.cs
- CaseInsensitiveHashCodeProvider.cs
- SqlCacheDependencySection.cs
- ComPlusDiagnosticTraceSchemas.cs
- WindowsGraphics2.cs
- UserValidatedEventArgs.cs
- BaseDataList.cs