Esempio n. 1
0
        private void WarmAndTest()
        {
            // Give the site an initial kick, so it's warm when it goes into the version table
            var healthRequest = new SerialisableRequest
            {
                Headers = new Dictionary <string, string> {
                    { "Accept", "text/plain,application/json" }
                },
                Method     = "GET",
                RequestUri = "/health"
            };
            var result = HostedSite.DirectCall(healthRequest);

            if (result.StatusCode > 499)
            {
                // We don't care about 'bad request' or 'file not found', in case the health endpoint is not implemented
                // However, if the site fails we will entirely reject this version
                HostedSite.Dispose();
                throw new WarmupCallException("Version wake-up failed: v" + MajorVersion + " at " + TargetPath + "; " + result.StatusCode + " " + result.StatusMessage);
            }
        }