예제 #1
0
        public void Dispose()
        {
            if (host != null)
            {
                host.Dispose();
                host = null;
                log.WithLogLevel(LogLevel.Debug)
                    .WriteMessage("Host Dispossed");

            }

            if (bootStrapper != null)
            {
                bootStrapper.Dispose();
                bootStrapper = null;
                log.WithLogLevel(LogLevel.Debug)
                    .WriteMessage("Bootstrapper Dispossed");
            }
        }
예제 #2
0
        public bool Start()
        { 
            if (host == null)
            {
                HostConfiguration config = new HostConfiguration();

                config.UrlReservations.CreateAutomatically = true;

                bootStrapper = new Bootstrapper();

                host = new NancyHost(bootStrapper, config, uri);
            }

            host.Start();

            log.WithLogLevel(LogLevel.Information)
                 .WriteMessage("Started Host on {0}", uri.ToString());

#if DEBUG
            System.Diagnostics.Process.Start(uri.ToString()  + "health");
#endif
            return true;
        }