1
votes

previously I've used grpc for .net core 2.x which is now known as the C-core grpc to differentiate itself from the new .net core 3's version. I like the way the new grpc is able to compiile and generate client/server stub classes from the proto files in VS2019 instead pf having to get the grpc tools from the packages folder, manually compiling it for C# to generate the client/server stub classes then importing into VS. it's cleaner with the new version of grpc. However, having used the C-core grpc with asp.net core web API, I do have some questions to ask about the new grpc-dotnet:

  1. in the C-core grpc, SSL/TLS certs use the *.pem format. I have used openSSL to generate the public/private key pems as such: "openssl req -x509 -newkey rsa:4096 -keyout private.pem -out public.pem -days 365 -nodes -subj /CN=< machine name >". Then in server side, I use SslServerCredentials to set it up and on client side, use SslCredentials to set it up. I've seen how to do this for client side for the new grpc-dotnet which isn't very different from the old way, but the server side of the new grpc-dotnet is really different now, with kestrel config. I don't know how to do it. Can someone please enlighten me on this? The Certifier example from the github uses pfx file. Is the pem key files still supported in the new grpc?

  2. the new grpc-dptmet ises lestrel now and seem to imply that it's using the same port as whatever is the web application using, except that http2 traffic would be routed to it and http1.1 would be handled by the web app. Now, it is possible to configure grpc to use another port instead of what the web app is using, and also to use a different SSL/TLS cert (*.pem files like above) instead of what is configured in IIS?

would be grateful if someone can enlighten me on these. thank you very much. :)

1

1 Answers

1
votes

Question 1: The .pem + .key way used by Grpc.Core is currently not supported by grpc-dotnet, but the difference is only in the key format accepted. It's not hard to convert the .pem and .key part into a single .pfx file using openssl command line tools (actually, here's the exact command you can use is mentioned here: https://github.com/grpc/grpc-dotnet/tree/master/testassets/Certs/InteropTests)

Question 2: With grpc-dotnet, you can either share the same port for both grpc and http traffic or you can expose two different ports - one for each of the protocols. The exact settings to achieve that I'm not 100% sure but it should be doable relatively easily.