Created
December 28, 2019 03:40
-
-
Save gistlyn/803dd0594f95bb14ad4fff90eec09200 to your computer and use it in GitHub Desktop.
ServiceStack C# gRPC Generic ServiceClient TodoWorld Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
using System.Security.Cryptography.X509Certificates; | |
using ServiceStack; | |
using TodoWorld.ServiceModel; | |
namespace TodoWorld | |
{ | |
class Program | |
{ | |
public static async Task Main(string[] args) | |
{ | |
var client = new GrpcServiceClient("https://todoworld.servicestack.net:50051", | |
new X509Certificate2("https://todoworld.servicestack.net/grpc.crt".GetBytesFromUrl()), | |
GrpcUtils.AllowSelfSignedCertificatesFrom("todoworld.servicestack.net")); | |
var response = await client.GetAsync(new Hello { Name = "gRPC C#" }); | |
Console.WriteLine(response.Result); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment