Grpc usage error in .net core: The remote certificate is invalid according to the validation procedure.
Grpc usage error in .net core: The remote certificate is invalid according to the validation procedure. Because Grpc uses HTTP/2 as the communication protocol, it adopts LTS/SSL encrypted transmission by default. For example, when using .net core to start a server (callee): public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.ConfigureKestrel(options => { options.ListenAnyIP(5000, listenOptions => { listenOptions.Protocols = HttpProtocols.Http2; listenOptions.UseHttps(“xxxxx.pfx”, “password “); }); }); webBuilder.UseStartup(); }); Use the UseHttps method to add certificates and keys. However, sometimes, such as the development stage, we may not have a certificate, or a temporary test certificate made by ourselves, then the following may appear in the client (caller) call Exception: Call failed with gRPC error status. Status code: ‘Internal’, Message: ‘Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception. AuthenticationException: The remote certificate is invalid according to the validation procedure.’. fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. Grpc.Core.RpcException: Status(StatusCode=”Internal”, Detail=”Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception .AuthenticationException: The remote certificate is invalid according to the validation procedure.”, DebugException=”System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. —> System.Security.Authentication.AuthenticationException: The remote…