A trivial program that echoes whatever is sent to it via HTTP or gRPC. Built from https://github.com/kzu/dotnet-echo/tree/3980b3067
$ dotnet add package dotnet-echoInstalling or updating (same command can be used for both):
dotnet tool update -g dotnet-echo
Usage:
> dotnet echo -?
echo
A trivial program that echoes whatever is sent to it via HTTP or gRPC
Usage:
echo [options] [<endpoint>...]
Arguments:
<endpoint> Endpoint to listen on such as https://127.0.0.0:8080/ [default: https://127.0.0.1:4242/]
Options:
-?, -h, --help Show help and usage information
The program will automatically check for updates once a day and recommend updating if there is a new version available.
The service supports gRPC too, with echo.proto:
syntax = "proto3";
service chamber {
rpc echo (message) returns (message);
}
message message {
string payload = 1;
}Since gRPC needs to use HTTP/2, it will use the defined prefix port + 1 (i.e. if you specify
http://127.0.0.1:8080, the gRPC endpoint will be available at http://127.0.0.1:8081).
Example of a .NET client to run echo in the chamber service:
<Project>
...
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="*" />
<PackageReference Include="Grpc.Net.Client" Version="*" />
<PackageReference Include="Grpc.Tools" Version="*" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="echo.proto" GrpcServices="Client" />
</ItemGroup>
</Project>var channel = GrpcChannel.ForAddress("http://localhost:8081");
var service = new chamber.chamberClient(channel);
var response = await service.echoAsync(new message { Payload = "Hello World" }, cancellationToken: cancellation);
Console.WriteLine(response.Payload);An example of the output during execution:

And running on Ubuntu:
