Exemple #1
0
        public void Start(Protocol aiProtocol, string aiHost, int aiPort)
        {
            string baseAddress = aiProtocol.ToString() + "://" + aiHost + ":" + aiPort.ToString() + "/";

            foreach (var ass in _assemblyControllers)
            {
                Startup.AddAssembly(ass);
            }

            // Start OWIN host
            using (WebApp.Start <Startup>(url: baseAddress))
            {
                // Create HttpCient and make a request to api/values
                HttpClient client   = new HttpClient();
                var        response = client.GetAsync(baseAddress + "api/healthcheck").Result;//Check if api is accessible
                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    Console.WriteLine("Everything seems running smoothly.");
                }
                else
                {
                    throw new Exception("HealthCheck ran wrong.");
                }
                Console.ReadLine();
            }
        }