简体   繁体   中英

Grpc Server Can not Overload method

I want to build a very simple client and server application in Grpc C# for first time I built it successfully but when I want to build an other Service got error 'C0115 no suitable method found for override '

Here is My Code:

ServiceHubService.cs in Services Folder

`
namespace NetPlus.Server.Core

{
    public class ServerHubService : ServereHub.ServereHubBase
   
 {
      
 
private readonly ILogger<ServerHubService> _logger;

       
 public ServerHubService(ILogger<ServerHubService> logger)
        {
            _logger = logger;
        }

        public override Task<ActionResult> GetActionResult(ActionRequest request, ServerCallContext context)
        {
            return Task.FromResult(new ActionResult
            {
                ActionResultType = "Test"
            });
        }
    }
    
}`

ProtoBuffer File:

  syntax = "proto3";
        
        option csharp_namespace = "NetPlus.Server.Core";
        
        package server;
        
        
        service ServereHub  {
        
        rpc ActionManager (ActionRequest) returns (ActionResult);
        
        }
        
        message ActionRequest {
            string ActionType = 1;
        }
        
        message ActionResult {
            string ActionResultType = 1;
        }

what is wrong?

I have using

visual studio 16.10.0 net 6.0 preview

In your proto file, you've defined

rpc ActionManager (ActionRequest) returns (ActionResult);

that means your method name will be ActionManager but you override GetActionResult .

So, could your please try to rename the method name?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM