4

I got an error when using grpc in .net core 3.0,

Here is error message:

[Grpc.Core.RpcException:“Status(StatusCode=Cancelled, Detail="No grpc-status found on response.")”]

My grpc server is like this :

one .net core Library with package grpc.aspnetcore(2.25) and one .net core api project with package grpc.aspnetcore.server(2.25), I register service in startup file. When I call the service in grpc client

I got the error As mentioned above.

This project directory structure this is service register enter image description here enter image description here

enter image description here

6
  • 1
    Could you provide a grpc.aspnetcore.server(2.25) , startup file? do you call app.UseEndpoints(endpoints => { endpoints.MapGrpcService<GreeterService>(); });
    – TemaTre
    Commented Dec 11, 2019 at 4:41
  • That's what I did
    – wannas
    Commented Dec 11, 2019 at 4:45
  • Are you shure that server is started and work? Can you check that port 44320 is bussy? Can you check that firewall is not block your requests?
    – TemaTre
    Commented Dec 11, 2019 at 4:50
  • Yes, the request can arrive at the server and be executed. When the client receives the return value, an error is reported
    – wannas
    Commented Dec 11, 2019 at 4:55
  • What's your NHBPddServiceIpm and greet.proto file ? How do you implement the service that NHBPddServiceIpm inherited? Could you provide a complete simple project , as your Grpc service does not use the default template and it contains some customized objects?
    – Xueli Chen
    Commented Dec 12, 2019 at 8:05

4 Answers 4

3

I found when run service as IIS-Express, The client always error. But run it as ProjectName, The client work fine! run ways image

I do not know why, but that just happened. So you can try it.

1
  • You are correct. apparently grpc isn't support in IIS. you configured VS to run under kestrel (default) instead of IIS. Commented May 22, 2020 at 18:21
0

Are you using IIS/IIS express. I was hitting the same issue when i lauched it in IISExpress. Change your launchSetting.json values as below and it will work.

{ "profiles": { "Greeter": { "commandName": "Project", "launchBrowser": false, "applicationUrl": "https://localhost:5001", "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" } } } }

1
  • 1
    So what is the actual fix? Which of these is the problem? What are we fixing here? what are we doing? Commented Jun 18, 2020 at 7:20
0

I was having the same issue when running the API under IIS. This is the default, and if you are running multiple startup projects, it is likely running under IIS.

To fix:

  • Check what HTTPS address/port your API project is running under (https://localhost:5001 is the default)

  • Target just the API project and change the run type from II Express to console (select whatever your project name is. See Example)

  • Change the startup projects to target your API and client app and run.

You should have two black console windows, and hopefully your call will be successful!

0

Kerwin Zhang solution is correct.

Check your Asp.Net core logs or the vs output window when you return from the service, you'll see some grpc trailer not supported exceptions. it most likely means you run the server with IIS or some unsupported platform... gRPC in ASP.NET Core currently doesn't support HttpSys/IIS/IIS Express.

Start the same project as kestrel instead of IIS and it should now work fine. (In VS Start debug button drop down change from [IIS Express] To [Your Project])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.