gRPC - csharp : How are you hosting your GRPC services?

1,530 views
Skip to first unread message

Rob Cecil

unread,
Jul 31, 2015, 5:08:44 PM7/31/15
to grpc.io
Been looking through this:


And I wonder how people are actually managing/hosting their gRPC services?

Thanks!

Jiri Jetmar

unread,
Aug 7, 2015, 4:16:47 AM8/7/15
to grpc.io
Hi Rob,

what do you mean with "hosting" ? Hosting more from the infrastructural point of view or more
from the architectural view ?

We are about to integrate gRPC in the Apache Zest (previous Qi4j)  in order to have a kind of structure that allows
to build microservices in a very fast way using the COP - Composite Oriented Programming approach.

Cheers,
Jiri

Jiri Jetmar

unread,
Aug 7, 2015, 4:18:24 AM8/7/15
to grpc.io
ahhh.. u are talking about csharp.. Sorry, I have here no idea, as I left the M$ platform years ago.. :-)


 

Am Freitag, 31. Juli 2015 23:08:44 UTC+2 schrieb Rob Cecil:

Jan Tattermusch

unread,
Aug 7, 2015, 6:04:03 AM8/7/15
to Rob Cecil, grpc.io
Just realized I replied only privately before, so reposting this here:

Hi,

not exactly sure what you are asking about, but I will try to answer:

gRPC C# should be able to run basically in any environment when you are able to run a .NET application using .NET framework or Mono. Currently, that means you should be able to run gRPC server on a Windows or Linux machine - or under Docker.

Obvious choices would be running a service on a Windows or Linux virtual machine inside Google Compute Engine or use Docker in  Managed VM or Google Container Engine.

We haven't investigated too much any ASP.NET specific integration yet, but we are planning to look into that in the future.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/1135ddb4-d6e0-4bd3-b221-6874b5ea4423%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jan Tattermusch

unread,
Aug 7, 2015, 6:09:15 AM8/7/15
to Rob Cecil, grpc.io
gRPC C# uses a native implementation under the hoods (the core written in C), so it is a basically standalone server. Going through the examples in https://github.com/grpc/grpc-common should tell you more.

Regarding Docker - yes gRPC C# works under docker.

On Sat, Aug 1, 2015 at 5:17 PM, Rob Cecil <rob....@gmail.com> wrote:
Hi Jan, 

My question was more about do you use Windows Services, ASP.NET, TopShelf, some container tech like Docker, etc.


On Sat, Aug 1, 2015 at 4:15 PM, Jan Tattermusch <jtatte...@google.com> wrote:
Hi,

not exactly sure what you are asking about, but I will try to answer:

gRPC C# should be able to run basically in any environment when you are able to run a .NET application using .NET framework or Mono. Currently, that means you should be able to run gRPC server on a Windows or Linux machine - or under Docker.

Obvious choices would be running a service on a Windows or Linux virtual machine inside Google Compute Engine or use Docker in  Managed VM or Google Container Engine.

We haven't investigated too much any ASP.NET specific integration yet, but we are planning to look into that in the future.

Jan

On Fri, Jul 31, 2015 at 2:08 PM, Rob Cecil <rob....@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.

rgard...@gmail.com

unread,
Apr 25, 2017, 11:57:51 AM4/25/17
to grpc.io
Hello Jan,
I would like to hear how you got gRPC C# to work in Docker.  I have tried to get GreeterServer gRPC sample (C# .Net) to work in Docker with no luck.  Using windowsservercore as image and installed vcredist.
Thanks,
Rich

Jan Tattermusch

unread,
Apr 27, 2017, 11:15:14 AM4/27/17
to rgard...@gmail.com, grpc.io
Hi, 

we actually haven't tried running gRPC C# in docker on Windows. All I know is I don't see a reason why it wouldn't work - what errors are you seeing? I suspect it's more question of having enough experience with docker on Windows (it's a fairly new thing) rather than an actual problem with gRPC. Please share your steps if you get this working.

With docker on Linux, we know everything works 100% - many of our tests actually run under docker.

Jan

To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.

To post to this group, send email to grp...@googlegroups.com.

jame...@gmail.com

unread,
Nov 28, 2017, 6:04:12 AM11/28/17
to grpc.io
I suppose you are wondering how to use dependency injection container to manage services in gRPC.

As far as I know, gRPC request processing model and ASP.NET Core is completely different. gRPC requires binding service definitions when the server is starting. You need to pass an instance of the service type as a parameter to the binding method. So, the DI containers should not be used as storage containers for service types. In fact, gRPC service's method is closer to the asp.net core controller. 

So unless gRPC's request-handling model makes major changes, we can only write code to manage the service ourselves.

在 2015年8月1日星期六 UTC+8上午5:08:44,Rob Cecil写道:

jame...@gmail.com

unread,
Nov 28, 2017, 6:18:18 AM11/28/17
to grpc.io
As a workaround, you can define your service this way:

public class AccountService : Account.AccountBase
   {
       private readonly IServiceProvider _provider;
       private readonly IServiceScopeFactory _scopeFactory;

        public AccountService(IServiceProvider provider)
       {
           _provider = provider;
           _scopeFactory = _provider.GetRequiredService<IServiceScopeFactory>();
       }

        public override Task<Empty> DisableAccount(DisableAccountRequest request, ServerCallContext context)
       {
           using (var scope = _scopeFactory.CreateScope())
           {
               // resolve your services here
           }
       }
   }



在 2015年8月1日星期六 UTC+8上午5:08:44,Rob Cecil写道:
Been looking through this:
Reply all
Reply to author
Forward
0 new messages