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
- FactoryRecord.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- DataErrorValidationRule.cs
- HtmlInputFile.cs
- LocalTransaction.cs
- NonParentingControl.cs
- DecoderFallback.cs
- PrintDocument.cs
- XmlAttributes.cs
- BasicKeyConstraint.cs
- SupportsEventValidationAttribute.cs
- WrappedIUnknown.cs
- DataGridCommandEventArgs.cs
- shaperfactoryquerycachekey.cs
- odbcmetadatacolumnnames.cs
- Bezier.cs
- SmtpTransport.cs
- SecurityHelper.cs
- CodeExporter.cs
- ItemsControl.cs
- LinqDataView.cs
- FormsAuthenticationCredentials.cs
- RegexRunner.cs
- DataKeyArray.cs
- SoapFault.cs
- HttpModuleActionCollection.cs
- DataTrigger.cs
- ThreadAttributes.cs
- RegexMatchCollection.cs
- Win32Native.cs
- FamilyCollection.cs
- EventData.cs
- TextStore.cs
- SqlUnionizer.cs
- XmlObjectSerializerReadContext.cs
- IgnoreSectionHandler.cs
- TableAdapterManagerGenerator.cs
- CodeExpressionCollection.cs
- CodeObjectCreateExpression.cs
- HtmlSelect.cs
- ListViewUpdatedEventArgs.cs
- SchemaImporterExtensionElementCollection.cs
- HttpPostedFile.cs
- HttpListenerPrefixCollection.cs
- XmlAtomErrorReader.cs
- SystemIcmpV4Statistics.cs
- DefaultHttpHandler.cs
- StringInfo.cs
- EntityDesignerUtils.cs
- CustomSignedXml.cs
- XmlCustomFormatter.cs
- assemblycache.cs
- ImageProxy.cs
- ShaperBuffers.cs
- RadioButton.cs
- CompositeKey.cs
- DynamicUpdateCommand.cs
- FrameworkContextData.cs
- TextCharacters.cs
- SaveFileDialogDesigner.cs
- DefaultValueAttribute.cs
- SecUtil.cs
- SafeBitVector32.cs
- CannotUnloadAppDomainException.cs
- EdgeModeValidation.cs
- CellIdBoolean.cs
- XamlHostingConfiguration.cs
- SqlDuplicator.cs
- EventHandlingScope.cs
- XmlConvert.cs
- mansign.cs
- PriorityChain.cs
- DataGridViewAdvancedBorderStyle.cs
- XsltException.cs
- ApplicationSecurityInfo.cs
- Composition.cs
- BoundingRectTracker.cs
- Size.cs
- PrintPageEvent.cs
- WebBrowserProgressChangedEventHandler.cs
- EntityParameterCollection.cs
- WindowsFormsLinkLabel.cs
- MimeFormReflector.cs
- _IPv4Address.cs
- Int64Converter.cs
- MemberAssignment.cs
- EntityEntry.cs
- FlowDocumentPaginator.cs
- ComboBox.cs
- ResponseStream.cs
- SelectionHighlightInfo.cs
- XslVisitor.cs
- ApplicationFileCodeDomTreeGenerator.cs
- CacheOutputQuery.cs
- OrderedDictionaryStateHelper.cs
- PropertyChangeTracker.cs
- EnumerableRowCollection.cs
- NgenServicingAttributes.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- BuildProviderAppliesToAttribute.cs