/// <summary> /// Starts this service instance. /// </summary> /// <param name="args">The <see cref="CommandLineArguments" /> provided to the start command.</param> /// <remarks> /// Valid startup args are: /// 0: Database Host Name where the SystemSettings database resides. /// 1: [Optional] Session Expiration Interval in hours. /// </remarks> protected override void StartService(CommandLineArguments args) { if (args == null) { throw new ArgumentNullException("args"); } FrameworkServiceHelper.LoadSettings(args); Task.Factory.StartNew(() => { FrameworkServiceHelper.UpdateServerInfo(); TraceFactory.Logger.Debug("Updating Server Info - Complete"); }); int expirationInterval = args.GetParameterValue <int>("expirationInterval"); //Start the service _monitorService = new STFMonitorService(expirationInterval); _monitorService.Start(); //Open the server WCF endpoint _serviceEndpoint = new WcfHost <ISTFMonitorService> ( _monitorService, MessageTransferType.Http, WcfService.STFMonitor.GetLocalHttpUri() ); _serviceEndpoint.Open(); }
/// <summary> /// Stops this service instance. /// </summary> protected override void StopService() { //Close the endpoint first _serviceEndpoint.Close(); _serviceEndpoint = null; _monitorService.Stop(); _monitorService = null; }