public override Task <PingResponse> UnaryPing(PingRequest request, ServerCallContext context) { if (request.Status == Status.Ok) { return(Task.FromResult(new PingResponse() { Message = "OK" })); } global::Grpc.Core.Status status = new global::Grpc.Core.Status(StatusCode.Internal, "details"); throw new RpcException(status); }
public override async Task ServerStreamingPing(PingRequest request, IServerStreamWriter <PingResponse> responseStream, ServerCallContext context) { if (request.Status == Status.Bad) { ThrowException(); } for (int i = 0; i < 1; i++) { await responseStream.WriteAsync(new PingResponse() { Message = "OK" }); } }
public override async Task <PingResponse> UnaryPing(PingRequest request, ServerCallContext context) { if (request.Status == Status.Ok) { PingResponse response = null; await Task.Run(() => response = new PingResponse() { Message = "OK" }); return(response); } global::Grpc.Core.Status status = new global::Grpc.Core.Status(StatusCode.Internal, "details"); throw new RpcException(status); }