/// <summary> /// Handle an incoming request using the hosted site /// </summary> public SerialisableResponse Request(SerialisableRequest request) { Interlocked.Increment(ref _callCount); var response = HostedSite.DirectCall(request); if (response.StatusCode > 499) { Interlocked.Increment(ref _failureCount); FailureHistory.Record(); } else { SuccessHistory.Record(); } return(response); }
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); } }