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

            var result = ServiceResult <IEnumerable <ServiceDescriptor> > .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 }));
        }