Example #1
0
        /// <summary>
        /// Runs the <see cref="WcfLogService" /> .
        /// </summary>
        /// <param name="logService">
        /// The <see cref="LogService" /> that will log the incoming messages.
        /// </param>
        /// <param name="baseAddresses">
        /// The base addresses for the <see cref="WcfLogService" /> .
        /// </param>
        /// <param name="endpointAddress">
        /// The endpoint address for the <see cref="WcfLogService" /> .
        /// </param>
        /// <param name="binding">
        /// The wcf binding for the <see cref="WcfLogService" /> .
        /// </param>
        /// <returns>
        /// <para>A <see cref="WcfLogService.ServiceHolder" /> that can be used to shut down the <see cref="WcfLogService" /> or <c> null </c></para>
        /// <para>if the service was already running.</para>
        /// </returns>
        public static ServiceHolder Run(
            LogService logService,
            Uri[] baseAddresses,
            string endpointAddress,
            Binding binding)
        {
            Validate.Value.IsNotNull(logService, nameof(logService));
            Validate.Value.IsNotNull(baseAddresses, nameof(baseAddresses));
            Validate.Value.IsNotEmpty(baseAddresses, nameof(baseAddresses));
            Validate.Value.IsNotNull(endpointAddress, nameof(endpointAddress));
            Validate.Value.IsNotNull(binding, nameof(binding));

            var dict = new Dictionary <string, Binding>
            {
                { endpointAddress, binding }
            };

            return(WcfLogService.Run(logService, baseAddresses, dict));
        }
Example #2
0
 /// <summary>
 /// Shuts down the <see cref="WcfLogService" /> using the specified timeout.
 /// </summary>
 /// <param name="timeout">The timeout.</param>
 public void Shutdown(TimeSpan timeout)
 {
     WcfLogService.SignalShutdown();
     this.serviceTask.Wait(timeout);
 }