I have an app started in Dapr that has a gRPC service. Starting Dapr with id MyGrpcApi001. HTTP Port: 55319. gRPC Port: 55320
I have started it with the following command:
dapr run --app-id MyGrpcApi001 --app-protocol grpc --app-port 5000 -- dotnet run
proto:
syntax = "proto3";
import "google/protobuf/empty.proto";
option csharp_namespace = "MyGrpcService";
package greet;
// The greeting service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply);
  rpc Test (google.protobuf.Empty) returns (google.protobuf.Empty);
}
// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}
// The response message containing the greetings.
message HelloReply {
  string message = 1;
}
I have a client that has 2 methods that connect using gRPC to the service
- one does the call to the service directly via auto-generated client
 - another through dapr sidecar gRPC port
 
    class Program
    {
        private static string LOCAL_ADDRESS = @"http://localhost:5000";
        private static string DAPR_ADDRESS = $"http://localhost:55320";
        static async Task Main(string[] args)
        {
            await CallToLocalHost().ConfigureAwait(false); // runs OK
            await CallWithClient().ConfigureAwait(false); // exception: Service is unimplemented
        }
        private static async Task CallToLocalHost()
        {
            using var channel = GrpcChannel.ForAddress(LOCAL_ADDRESS);
            var cl = new MyGrpcService.Greeter.GreeterClient(channel);
            MyGrpcService.HelloReply response = await cl.SayHelloAsync(new MyGrpcService.HelloRequest { Name = "ThinkPad" });
            Console.WriteLine(response.Message);
        }
        private static async Task CallWithClient()
        {
            using DaprClient client = new DaprClientBuilder()
                     .UseGrpcEndpoint(DAPR_ADDRESS)
                     .Build();
            var request = new MyGrpcService.HelloRequest { Name = "ThinkPad" };
            var result = await client.InvokeMethodGrpcAsync<MyGrpcService.HelloRequest, MyGrpcService.HelloReply>("MyGrpcApi001", "SayHello", request).ConfigureAwait(false);
        }
    }
the second method does not seem to work, so the direct call works, but the sidecar does not seem to find the service. Here are the logs for both:
the logs from the running service:
First method OK:
== APP == info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
== APP ==       Request starting HTTP/2 POST http://localhost:5000/greet.Greeter/SayHello application/grpc -
== APP == info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
== APP ==       Executing endpoint 'gRPC - /greet.Greeter/SayHello'
== APP == info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
== APP ==       Executed endpoint 'gRPC - /greet.Greeter/SayHello'
== APP == info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
== APP ==       Request finished HTTP/2 POST http://localhost:5000/greet.Greeter/SayHello application/grpc - - 200 - application/grpc 0.3074ms
Second method Error:
== APP == info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
== APP ==       Request starting HTTP/2 POST http://127.0.0.1:5000/dapr.proto.runtime.v1.AppCallback/OnInvoke application/grpc -
== APP == info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
== APP ==       Executing endpoint 'gRPC - Unimplemented service'
== APP == info: Grpc.AspNetCore.Server.Internal.ServerCallHandlerFactory[1]
== APP ==       Service 'dapr.proto.runtime.v1.AppCallback' is unimplemented.
== APP == info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
== APP ==       Executed endpoint 'gRPC - Unimplemented service'
== APP == info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
== APP ==       Request finished HTTP/2 POST http://127.0.0.1:5000/dapr.proto.runtime.v1.AppCallback/OnInvoke application/grpc - - 200 0 application/grpc 0.1474ms
the second one seems to have the wrong URL that includes /dapr.proto.runtime. ...
What am I doing wrong here? Is the dapr run command wrong, or do I have the wrong parameters for the InvokeMethodGrpcAsync method?
Since I can run the method directly through the auto-generated client, I think that the server works OK, it is that dapr does not find the service and/or the methods.
Any ideas?
Thanks!