Beispiel #1
0
        public void StartServer()
        {
            IgnoreCertErrorPolicy.Register();

            if (OsInfo.IsWindows)
            {
                if (_runtimeInfo.IsAdmin)
                {
                    _firewallAdapter.MakeAccessible();
                    _sslAdapter.Register();
                }

                _urlAclAdapter.ConfigureUrl();
            }

            var options = new StartOptions(_urlAclAdapter.Url)
            {
                ServerFactory = "Microsoft.Owin.Host.HttpListener"
            };

            if (_configFileProvider.EnableSsl)
            {
                _logger.Trace("SSL enabled, listening on: {0}", _urlAclAdapter.HttpsUrl);
                options.Urls.Add(_urlAclAdapter.HttpsUrl);
            }

            _logger.Info("starting server on {0}", _urlAclAdapter.Url);

            try
            {
                _host = WebApp.Start(OwinServiceProviderFactory.Create(), options, BuildApp);
            }
            catch (TargetInvocationException ex)
            {
                if (ex.InnerException == null)
                {
                    throw;
                }

                if (ex.InnerException is HttpListenerException)
                {
                    throw new PortInUseException("Port {0} is already in use, please ensure NzbDrone is not already running.",
                                                 ex,
                                                 _configFileProvider.Port);
                }

                throw ex.InnerException;
            }
        }
Beispiel #2
0
        public void StartServer()
        {
            IgnoreCertErrorPolicy.Register();

            if (OsInfo.IsWindows)
            {
                if (_runtimeInfo.IsAdmin)
                {
                    _firewallAdapter.MakeAccessible();
                    _sslAdapter.Register();
                }
            }

            _urlAclAdapter.ConfigureUrl();

            var options = new StartOptions()
            {
                ServerFactory = "Microsoft.Owin.Host.HttpListener"
            };

            _urlAclAdapter.Urls.ForEach(options.Urls.Add);

            _logger.Info("Listening on the following URLs:");
            foreach (var url in options.Urls)
            {
                _logger.Info("  {0}", url);
            }

            try
            {
                _host = WebApp.Start(OwinServiceProviderFactory.Create(), options, BuildApp);
            }
            catch (TargetInvocationException ex)
            {
                if (ex.InnerException == null)
                {
                    throw;
                }

                if (ex.InnerException is HttpListenerException)
                {
                    throw new PortInUseException("Port {0} is already in use, please ensure NzbDrone is not already running.",
                                                 ex,
                                                 _configFileProvider.Port);
                }

                throw ex.InnerException;
            }
        }
Beispiel #3
0
        public void StartServer()
        {
            IgnoreCertErrorPolicy.Register();

            if (OsInfo.IsWindows)
            {
                if (_runtimeInfo.IsAdmin)
                {
                    _firewallAdapter.MakeAccessible();
                    _sslAdapter.Register();
                }
            }

            _urlAclAdapter.ConfigureUrl();

            _logger.Info("Listening on the following URLs:");
            foreach (var url in _urlAclAdapter.Urls)
            {
                _logger.Info("  {0}", url);
            }

            _owinApp = _owinAppFactory.CreateApp(_urlAclAdapter.Urls);
        }