Hello,

I don't know of a ready-to-use generic proxy for ASP.NET, but it's 
something that wouldn't be hard to implement.  Important things to know:
1. instead of de-serializing the message payload, one would need to use a 
custom serializer/deserializer that would simply read the payloads as 
binary blobs (as in the general case you don't know the type of the message 
in a generic rpc).
2. you would only need to have one generic bi-di streaming handler for all 
types of RPCs. In a sense, the unary / client streaming / server streaming 
calls are just a special case of a bi-di streaming call. The information 
which RPC is unary (or other kind) basically only comes from the .proto 
schema and it doesn't change how the RPCs looks on the wire.
3. an unknown service handler is also implemented in grpc-dotnet - you can 
take a look at the source code and perhaps that would give you some tips on 
how to implement a "fallback" handler.
4. in ASP.NET core, since it's a HTTP/2 server, you could simply implement 
the proxy a HTTP/2 request forwarder (each RPC will be a new HTTP/2 stream 
and will invoke a separate HTTP/2 request handler).

So I believe a basic generic proxy that forwards all RPCs could be written 
in <100 lines code. Besides that, since gRPC works over HTTP/2, any HTTP/2 
compliant proxy would also work for proxying gRPC traffic.

On Saturday, April 10, 2021 at 2:10:26 AM UTC+2 [email protected] wrote:

> Hi GRPC Team,
>
>  
>
> Is there a recommended pattern for implementing transparent proxy for 
> ASP.NET GRPC services?  For golang I found some implementation based of – 
> “grpc.UnknownServiceHandler” - grpc · pkg.go.dev 
> <https://pkg.go.dev/google.golang.org/[email protected]#UnknownServiceHandler>
>
>
> Basically, I am trying to see if there is a way to do something like 
> following in C#, which gives access to streams
>
>  
>
> grpc-proxy/handler.go at master · mwitkow/grpc-proxy · GitHub 
> <https://github.com/mwitkow/grpc-proxy/blob/master/proxy/handler.go#L29>
>
>  
>
> *fakeDesc := &grpc.ServiceDesc{*
>
> *ServiceName: serviceName,*
>
> *HandlerType: (*interface{})(nil),*
>
> *       }*
>
>  
>
> Regards,
>
> Vivek Aggarwal
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/8530eab6-f53e-4ec1-ab2b-26804974460cn%40googlegroups.com.

Reply via email to