How to enable server side SSL for gRPC?

后端 未结 3 506
盖世英雄少女心
盖世英雄少女心 2020-12-07 23:39

New to gRPC and couldn\'t really find any example on how to enable SSL on the server side. I generated a key pair using openssl but it complains that the private key is inv

3条回答
  •  暖寄归人
    2020-12-08 00:04

    If you have tried what @qmo has suggested and still not working and you're getting the same error saying "StatusCode=Unavailable, Detail="DNS resolution failed" I fixed it by adding a new record in my host file (located in C:\Windows\System32\drivers\etc for Windows).

    127.0.0.1 DESKTOP-QNCI7UN
    

    Where DESKTOP-QNCI7UN is the name of my machine. Then in the client I'm using:

    channel = new Channel("DESKTOP-QNCI7UN", 50000, ssl);
    

    By using "locahost" it was not working. So by using the machine name in the client + added record in the host file fixed the issue.

提交回复
热议问题