public async Task <IActionResult> GetAddress([FromServices] IServiceDiscoveryProvider serviceDiscoveryProvider, string queryParam)
        {
            var list = await serviceDiscoveryProvider.GetAddressAsync(queryParam);

            var result = ServiceResult <IEnumerable <ServiceAddressModel> > .Create(true, list);

            return(Json(result));
        }
Example #2
0
        /// <summary>
        /// 获取所用服务的描述
        /// 调试 http://127.0.0.1:729/api/Home/GetServiceDescriptor?address=127.0.0.1:98
        /// </summary>
        /// <param name="serviceDiscoveryProvider"></param>
        /// <param name="address"></param>
        /// <param name="queryParam"></param>
        /// <returns></returns>
        public async Task <IActionResult> GetAddress([FromServices] IServiceDiscoveryProvider serviceDiscoveryProvider, string address, string queryParam)
        {
            var adlist = await serviceDiscoveryProvider.GetAddressAsync();

            IList <object> list = new List <object>();

            foreach (ServiceAddressModel item in adlist)
            {
                var    ip    = item.Address as IpAddressModel;
                string str   = ip.Ip + ":" + ip.Port;
                var    lista = await serviceDiscoveryProvider.GetServiceDescriptorAsync(str);

                list.Add(lista);
            }
            return(Json(new { A = adlist, B = list }));
        }
        public async Task <IActionResult> EditServiceToken([FromServices] IServiceDiscoveryProvider serviceDiscoveryProvider, string address)
        {
            var list = await serviceDiscoveryProvider.GetAddressAsync(address);;

            return(View(list.FirstOrDefault()));
        }