Esempio n. 1
0
        public void Run(string baseAddress)
        {
            var config = HypermediaApiConfiguration.ConfigureSite(baseAddress);

            var host = new HttpSelfHostServer(config);

            host.OpenAsync().Wait();

            Console.WriteLine("Press enter to shutdown service");
            Console.ReadLine();

            host.CloseAsync().Wait();
        }
Esempio n. 2
0
        protected override void OnStart(string[] args)
        {
            try
            {
                var baseAddress = (args.Length == 0) ? "http://hypermediaapi.com" : args[0];

                Trace.WriteLine(String.Format("Service starting on address:  {0}", baseAddress));

                var config = HypermediaApiConfiguration.ConfigureSite(baseAddress);

                _Host = new HttpSelfHostServer(config);

                _Host.OpenAsync().Wait();

                Trace.WriteLine("Service started");
            } catch (Exception ex)
            {
                Trace.TraceError((ex.InnerException != null ? ex.InnerException.Message : ex.Message));
                this.Stop();
            }
        }