コード例 #1
0
        public async Task<IHttpActionResult> IndexAsync() {
            if (_lastHealthCheckResult == null || _nextHealthCheckTimeUtc < DateTime.UtcNow) {
                _nextHealthCheckTimeUtc = DateTime.UtcNow.AddSeconds(5);
                _lastHealthCheckResult = await _healthChecker.CheckAllAsync();
            }

            if (!_lastHealthCheckResult.IsHealthy)
                return StatusCodeWithMessage(HttpStatusCode.ServiceUnavailable, _lastHealthCheckResult.Message, _lastHealthCheckResult.Message);

            if (Settings.Current.HasAppScope) {
                return Ok(new {
                    Message = "All Systems Check",
                    Settings.Current.Version,
                    Settings.Current.AppScope,
                    WebsiteMode = Settings.Current.WebsiteMode.ToString(),
                    Environment.MachineName
                });
            }

            return Ok(new {
                Message = "All Systems Check",
                Settings.Current.Version,
                WebsiteMode = Settings.Current.WebsiteMode.ToString(),
                Environment.MachineName
            });
        }
コード例 #2
0
        public async Task<IHttpActionResult> IndexAsync() {
            if (_lastHealthCheckResult == null || _nextHealthCheckTimeUtc < DateTime.UtcNow) {
                _nextHealthCheckTimeUtc = DateTime.UtcNow.AddSeconds(5);
                _lastHealthCheckResult = await _healthChecker.CheckAllAsync();
            }

            if (!_lastHealthCheckResult.IsHealthy)
                return StatusCodeWithMessage(HttpStatusCode.ServiceUnavailable, _lastHealthCheckResult.Message, _lastHealthCheckResult.Message);

            return Ok(new StatusResult { Message = "All Systems Check", Version = Settings.Current.Version });
        }