public string GetNameByService(string name) { var service = ConsulHelper.GetService(consulAddress: Configuration["ConsulOption:ConsulAddress"], serviceName: Configuration["ConsulOption:ServiceName"]); using (var client = new HttpClient()) { Task <string> result = client.GetStringAsync($"http://{service.ServiceAddress}:{service.ServicePort}/api/ServiceFinder/GetName?name={name}"); return($"{service.ServiceAddress}:{service.ServicePort} -> result :{result.Result}"); } }
public string Get() { var service = ConsulHelper.GetService(consulAddress: Configuration["ConsulOption:ConsulAddress"], serviceName: Configuration["ConsulOption:ServiceName"]); return($@"CatalogService:{JsonConvert.SerializeObject(service)}"); }