Ejemplo n.º 1
0
        static public void StartAsConosle(string baseAddress, Action <HttpSelfHostServer> afterOpen)
        {
            SimpleHost.Start(() =>
            {
                var config = new HttpSelfHostConfiguration(baseAddress);
                config.Routes.MapHttpRoute("API Default", "api/{controller}/{id}", new { id = RouteParameter.Optional });

                using (var server = new HttpSelfHostServer(config))
                {
                    server.Open();
                    afterOpen(server);
                }
            });
        }