public async Task <string> ResolveServiceInstance(string serviceName) { string url = string.Empty; if (!string.IsNullOrEmpty(serviceName)) { var healthInstances = await discoveryClient.GetServicesWithCache(serviceName, distributedCache, cacheEntryOptions); if (healthInstances != null && healthInstances.Count > 0) { url = healthInstances[Random.Next(healthInstances.Count)]; } } return(url); }