微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用此状态解决 gRPC 异常StatusCode="Unimplemented", Detail="Service is unimplemented."?

如何解决如何使用此状态解决 gRPC 异常StatusCode="Unimplemented", Detail="Service is unimplemented."?

我在我的 .net core 3.1 项目中实现了 gRPC。虽然它在我的本地工作,但在服务器上不起作用。我尝试在我的项目中实现所有必要的东西来支持 gRPC。 在 appsettings 我使用 http2

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

启动时:

   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>();
            });
        }

但它在服务器中不起作用,我收到了这个例外:

Grpc.Core.RpcException: Status(StatusCode="Unimplemented",Detail="服务未实现。") 在 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 请求,ClientInterceptorContext2 context,BlockingUnaryCallContinuation2 继续)在 Grpc.Core.Interceptors.InterceptingCallInvoker.BlockingUnaryCall[TRequest,TResponse](方法`2 方法、字符串主机、CallOptions 选项、TRequest 请求)。 . . . .

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。