/// <summary>
        /// Starting and listening for incoming requests.
        /// </summary>
        private async void ThreadProcAsync()
        {
            try
            {
                using (System.Net.HttpListener listener = new System.Net.HttpListener())
                {
                    listener.Prefixes.Add(contextOptions.ListenerPrefix);

                    // We do not use AuthenticationSchemes.Digest here because OPTIONS request must be processed without authentication.
                    // Instead this sample provides its own Digest authentication implementation.
                    listener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;

                    listener.IgnoreWriteExceptions = true;

                    listener.Start();

                    string listenerPrefix = contextOptions.ListenerPrefix.Replace("+", LocalIPAddress().ToString());
                    string startMessage   = $"Started listening on {contextOptions.ListenerPrefix}.\n\n" +
                                            $"To access your files go to {listenerPrefix} in a web browser. Or just connect to the above address using WebDAV client.";
                    logger.LogDebug(startMessage);
                    logMethod.LogOutput(startMessage);

                    while (Listening)
                    {
                        HttpListenerContext context = await listener.GetContextAsync();

#pragma warning disable 4014
                        Task.Factory.StartNew(() => ProcessRequestAsync(listener, context));
#pragma warning restore 4014
                    }
                }
            }
            catch (HttpListenerException ex) when(ex.ErrorCode == 5)
            {
                logger.LogError("Access is denied, try to run with administrative privileges.", null);
            }
            catch (Exception ex)
            {
                logger.LogError(ex.Message, ex);
            }
        }
 /// <summary>
 /// Logs errors on application view and in file.
 /// </summary>
 /// <param name="message">Text to output.</param>
 /// <param name="exception">Exception instance.</param>
 public override void LogError(string message, Exception exception)
 {
     base.LogError(message, exception);
     logMethod.LogOutput($"{message}\n{exception?.StackTrace}");
 }