Exemplo n.º 1
0
        public async Task RunAsync()
        {
            try {
                await EnsureCertificateAsync();
            } catch (LetsEncryptException ex) {
                if (ErrorHandler != null)
                {
                    var errorInfo = new ErrorInfo {
                        Continue  = ContinueHandler != null,
                        Exception = ex
                    };

                    ErrorHandler(errorInfo);

                    if (!errorInfo.Continue)
                    {
                        ContinueHandler = null;
                    }
                }
            }

            // Retrieve the certificate from loader
            CertificateLoader.TryLoad(Options.Hostname, out var certificate);

            // This starts the actual web app
            await ContinueHandler
            ?.Invoke(certificate)
            ?.RunAsync();
        }
Exemplo n.º 2
0
        public void Run()
        {
            try {
                EnsureCertificate();
            } catch (LetsEncryptException ex) {
                Logger?.LogError(ex, ex.InnerException?.Message);

                if (ErrorHandler != null)
                {
                    var errorInfo = new ErrorInfo {
                        Continue  = ContinueHandler != null,
                        Exception = ex
                    };

                    ErrorHandler(errorInfo);

                    if (!errorInfo.Continue)
                    {
                        ContinueHandler = null;
                    }
                }
            }

            // Retrieve the certificate from loader
            CertificateLoader.TryLoad(Options.Hostname, out var certificate);

            // This starts the actual web app
            ContinueHandler
            ?.Invoke(certificate)
            ?.Run();
        }