Ejemplo n.º 1
0
        protected override void OnStart(string[] args)
        {
            try
            {
                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    ListenerTraceUtility.TraceEvent(TraceEventType.Information, ListenerTraceCode.ServiceStart, SR.GetString(SR.TraceCodeServiceStart), this);
                }

#if DEBUG
                if (DebuggableService.DelayStart(ServiceName))
                {
                    (new Thread(new ThreadStart(Start))).Start();
                    return;
                }
#endif

                Start();
            }
            catch (Exception exception)
            {
                // Log the error to eventlog.
                ListenerTraceUtility.EventLog.LogEvent(TraceEventType.Error,
                                                       (ushort)System.Runtime.Diagnostics.EventLogCategory.ListenerAdapter,
                                                       (uint)System.Runtime.Diagnostics.EventLogEventId.ServiceStartFailed,
                                                       false,
                                                       exception.ToString());

                throw;
            }
        }
Ejemplo n.º 2
0
        void Start()
        {
#if DEBUG
            DebuggableService.WaitForDebugger(ServiceName);
#endif
            serviceCore.Start();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        protected override void OnStart(string[] args)
        {
            if (DiagnosticUtility.ShouldTraceInformation)
            {
                ListenerTraceUtility.TraceEvent(TraceEventType.Information, ListenerTraceCode.ServiceStart, SR.GetString(SR.TraceCodeServiceStart), this);
            }

#if DEBUG
            if (DebuggableService.DelayStart(ServiceName))
            {
                (new Thread(new ThreadStart(Start))).Start();
                return;
            }
#endif
            Start();
        }