private bool ValidateIfIpIsInWhiteList(HttpContext context) { var remoteIp = IPAddressHelper.GetRequestIP(context); _logger.LogInformation($"访问 IP地址为 RemoteIP:{remoteIp}"); string[] allowedIps = _whiteListIps.Split(';'); if (!allowedIps.Any(ip => ip == remoteIp.ToString())) { context.Response.StatusCode = (int)HttpStatusCode.Forbidden; return(false); } return(true); }