Exemplo n.º 1
0
        public void Run(CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            var nancyConfig = new HostConfiguration
            {
                UrlReservations = new UrlReservations
                {
                    CreateAutomatically = true
                }
            };

            var bootstrapper = new ApiBootstrapper(_repository);

            var host = new NancyHost(bootstrapper, nancyConfig, _baseUri);

            cancellationToken.Register(() =>
            {
                Log.InfoFormat("Stopping Nancy host at \"{0}\".", _baseUri);
                host.Stop();
                Log.InfoFormat("Nancy host at \"{0}\" successfully stopped.", _baseUri);
            });

            Log.InfoFormat(CultureInfo.InvariantCulture, "Starting Nancy host at \"{0}\".", _baseUri);
            host.Start();
        }
Exemplo n.º 2
0
        public void Run(CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
                return;

            var nancyConfig = new HostConfiguration
            {
                UrlReservations = new UrlReservations
                {
                    CreateAutomatically = true
                }
            };

            var bootstrapper = new ApiBootstrapper(_repository);

            var host = new NancyHost(bootstrapper, nancyConfig, _baseUri);
            cancellationToken.Register(() =>
            {
                Log.InfoFormat("Stopping Nancy host at \"{0}\".", _baseUri);
                host.Stop();
                Log.InfoFormat("Nancy host at \"{0}\" successfully stopped.", _baseUri);
            });

            Log.InfoFormat(CultureInfo.InvariantCulture, "Starting Nancy host at \"{0}\".", _baseUri);
            host.Start();
        }