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
- nulltextcontainer.cs
- PnrpPermission.cs
- SafeCancelMibChangeNotify.cs
- XhtmlBasicControlAdapter.cs
- DefinitionBase.cs
- RangeValuePatternIdentifiers.cs
- WindowsServiceCredential.cs
- CookieHandler.cs
- HierarchicalDataTemplate.cs
- ProviderException.cs
- NamedElement.cs
- TimeSpanValidator.cs
- XmlSchemaIdentityConstraint.cs
- RelationshipEndMember.cs
- CfgArc.cs
- SQLBytes.cs
- DateTimeOffsetStorage.cs
- GeneralTransform2DTo3D.cs
- ServiceThrottlingElement.cs
- EdmError.cs
- PageContentAsyncResult.cs
- FontFamily.cs
- TextRunCacheImp.cs
- PeerObject.cs
- IisTraceWebEventProvider.cs
- UshortList2.cs
- HttpClientChannel.cs
- DbConnectionPoolIdentity.cs
- XamlFxTrace.cs
- SmtpCommands.cs
- VisualBrush.cs
- columnmapfactory.cs
- PenThreadWorker.cs
- SoapObjectInfo.cs
- StoreAnnotationsMap.cs
- XmlQueryType.cs
- AuthenticationService.cs
- PropertyGrid.cs
- SQLGuid.cs
- WindowsAuthenticationModule.cs
- HttpAsyncResult.cs
- TextCompositionEventArgs.cs
- BindStream.cs
- METAHEADER.cs
- DebuggerAttributes.cs
- CollectionViewGroupRoot.cs
- ComponentResourceKey.cs
- diagnosticsswitches.cs
- Pair.cs
- CompilationUtil.cs
- PrinterSettings.cs
- ActivityInterfaces.cs
- RoutingUtilities.cs
- DetailsViewUpdateEventArgs.cs
- KnownBoxes.cs
- XmlSchemaImport.cs
- HtmlInputControl.cs
- DataGridViewCellCancelEventArgs.cs
- InternalDispatchObject.cs
- FilterRepeater.cs
- SessionStateContainer.cs
- CodeLinePragma.cs
- InstanceDataCollection.cs
- ButtonChrome.cs
- DesignerRegion.cs
- WebServiceErrorEvent.cs
- MaskedTextBoxTextEditor.cs
- DataTableCollection.cs
- returneventsaver.cs
- LinqDataSourceDeleteEventArgs.cs
- FormsAuthenticationUser.cs
- Point3D.cs
- CodeMemberEvent.cs
- LookupBindingPropertiesAttribute.cs
- ExpanderAutomationPeer.cs
- X509RecipientCertificateClientElement.cs
- UdpDiscoveryMessageFilter.cs
- ErrorRuntimeConfig.cs
- AttributeEmitter.cs
- WindowsStatusBar.cs
- AttachInfo.cs
- loginstatus.cs
- JsonDataContract.cs
- WorkflowRuntime.cs
- TransformDescriptor.cs
- UTF8Encoding.cs
- StackOverflowException.cs
- GenerateTemporaryTargetAssembly.cs
- Track.cs
- NumberFormatInfo.cs
- Html32TextWriter.cs
- StandardCommandToolStripMenuItem.cs
- Size3DValueSerializer.cs
- ProcessRequestArgs.cs
- WebPartVerbsEventArgs.cs
- AnimatedTypeHelpers.cs
- SchemaExporter.cs
- BinarySerializer.cs
- UpDownBaseDesigner.cs
- MonitoringDescriptionAttribute.cs