Can a grpc service able to be called from .net core webapi service.

43 views
Skip to first unread message

rbl...@kaplan.edu

unread,
Apr 17, 2018, 2:18:05 PM4/17/18
to grpc.io
I have a C# grpc service that works fine if I call it from a .Net Core Console app...However, I get the following error if I try to call it from a .Net Core Webapi Project [Status(StatusCode=Unavailable, Detail="Connect Failed")].  The difference between the console app and the webapi app is that I am not creating the channel in the main method...I am instead creating it elsewhere...I have tried several different ways:
  • In the startup class, and inject it as a dependency injection to a repository class to use it.
  • Creating new instance in my repository class.
  • Creating a new instance in my webapi controller.
But, all those methods result in the same error of: [Status(StatusCode=Unavailable, Detail="Connect Failed")]

Does anyone have any insight on how to get over this hurdle?...The big picture is a webapi .net core aggregation rest service, that will be calling underlying grpc services. Is that just not possible?

Thanks in advance,

Jan Tattermusch

unread,
Apr 24, 2018, 4:14:34 AM4/24/18
to grpc.io
Have you tried setting env. variable GRPC_VERBOSITY=debug (will give you extra info) and potentially also GRPC_TRACE=...   (see https://github.com/grpc/grpc/blob/master/doc/environment_variables.md). This might tell you more about why you are getting the Unavailable status (e.g. resolution problem, channel's failure to connect etc...).

From your description, I don't see anything wrong with what you are doing - things should work the same. It also seems that the native extension has been loaded correctly (because you are able to start a call and get a statuscode back), so .NET core app and .NET core webapi project should really behave the same
(also because the call handling actually happens in the native code, so it shouldn't matter what .NET application type you are using).
Reply all
Reply to author
Forward
0 new messages