コード例 #1
0
        public HomeController(ILogger <HomeController> logger)
        {
            _logger = logger;

            var channel = GrpcChannel.ForAddress("https://localhost:5001");

            _client = new Products.ProductsClient(channel);
        }
コード例 #2
0
        public ProductRpcService(IOptions <OrderRpcServcieSetting> setting, IHttpContextAccessor httpContext)
        {
            _setting     = setting.Value;
            _httpContext = httpContext;

            // GrpcChannel.ForAddress(_setting.OrderServcieHost);
            _channel = GrpcServiceHelper.CreateAuthenticatedChannel(_setting.OrderServcieHost, httpContext);
            _client  = new Products.ProductsClient(_channel);
        }