Example #1
0
        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}");
            }
        }
Example #2
0
        public string Get()
        {
            var service = ConsulHelper.GetService(consulAddress: Configuration["ConsulOption:ConsulAddress"], serviceName: Configuration["ConsulOption:ServiceName"]);

            return($@"CatalogService:{JsonConvert.SerializeObject(service)}");
        }