其他分享
首页 > 其他分享> > .netcore grpc The SSL connection could not be established,

.netcore grpc The SSL connection could not be established,

作者:互联网

添加允许不授信的证书或者无效的证书

 // 1、建立连接
var httpClientHandler = new HttpClientHandler();
// Return `true` to allow certificates that are untrusted/invalid
httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
var httpClient = new HttpClient(httpClientHandler);


using var channel2 = GrpcChannel.ForAddress("https://localhost:8711", new GrpcChannelOptions { HttpClient = httpClient });
var client2 = new Address.AddressClient(channel2);
var reply2 = await client2.TestMethodAsync(
new AddressRequest { Address = "GreeterClient" });

标签:established,netcore,grpc,client2,channel2,httpClientHandler,var,new,httpClient
来源: https://www.cnblogs.com/ives/p/15098422.html