2

I implemente gRPC in my .net core 3.1 projects. Although it works in my local, does not work on server. I try to implement every things that is necessary in my project to support gRPC. In appsettings I use http2

"EndpointDefaults": {
      "Protocols": "Http2;Http"
    },

In startup :

   public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton<IConfiguration>(Configuration);
           
            
            
            services.UseOption<GrpcAddressesOptions>();
            
            services.AddGrpc(o => { o.EnableDetailedErrors = true; });

           

        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddManexLoggerProvider();

            if (env.IsDevelopment())
                app.UseDeveloperExceptionPage();
            else if (env.IsProduction() || env.IsStaging()) app.UseManexExceptionHandler();
            app.UseForwardedHeaders();
            app.UseHsts();

            app.UseRouting();
          
         
            //TODO CheckEndpoint
            app.UseEndpoints(endPoints => {
            endPoints.MapGrpcService<GrpcCaller>();
            });
        }

But it does not work in servers and I receive this exeption:

Grpc.Core.RpcException: Status(StatusCode="Unimplemented", Detail="Service is unimplemented.") at Grpc.Net.Client.Internal.HttpClientCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method2 method, String host, CallOptions options, TRequest request) at Grpc.Core.Interceptors.InterceptingCallInvoker.<BlockingUnaryCall>b__3_0[TRequest,TResponse](TRequest req, ClientInterceptorContext2 ctx) at Grpc.Core.ClientBase.ClientBaseConfiguration.ClientBaseConfigurationInterceptor.BlockingUnaryCall[TRequest,TResponse](TRequest request, ClientInterceptorContext2 context, BlockingUnaryCallContinuation2 continuation) at Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](Method`2 method, String host, CallOptions options, TRequest request) . . . . .

  • Can you enable extra logging to see what the the incoming requests on the server side? (and what is their URL). If you're getting "Service is unimplemented" for a service that you believe you've implemented, the issue is likely that for some reason, a wrong URL is being used for the requests (for server foo.bar the URL to access a service called "namespace.myService" is "foo.bar/namespace.myService/methodName"). See https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md – Jan Tattermusch Apr 08 '21 at 12:13

1 Answers1

0

Share a sample of your proto file

Note: Make sure your .proto file is identical for both client and server and it has the same package. When the client calls a method on the remote server, it uses the full name of the remote class and the package.

user1093452
  • 121
  • 2
  • 3
  • 19