예제 #1
0
        private async Task <(UserInfoService.UserInfoServiceClient Client, string Msg)> GetClientAsync(string name)
        {
            var target = await _findService.FindServiceAsync(name);

            _logger.LogInformation($"Current target = {target}");

            if (string.IsNullOrWhiteSpace(target))
            {
                return(null, "can not find a service");
            }
            else
            {
                var channel = new Channel(target, ChannelCredentials.Insecure);

                var client = new UserInfoService.UserInfoServiceClient(channel);
                return(client, string.Empty);
            }
        }
예제 #2
0
 public ABasedService()
 {
     _channel = new Channel("localhost:9999", ChannelCredentials.Insecure);
     _client  = new UserInfoService.UserInfoServiceClient(_channel);
 }