Responded here: https://github.com/grpc/grpc/issues/20346
On Tue, Sep 24, 2019 at 11:17 AM <[email protected]> wrote: > I am trying to use Grpc.Core.Channel call gRPC service. When code run in > Partial Trust environment, an error below would pop up. > "Inheritance security rules violated by > Type:'Grpc.Core.internal.SafeHandleZeroIsInvalid' Derived types must either > match the security accessibility of the base type or be less accessible" > > How can I use Channel to call Grpc service on a partial trust environment? > if can't, is there another way to call Grpc Service? > > Look into gRPC code, a .net class SafeHandle is inherited by > SafeHandleZeroIsInvalid. As official document described, for partially > trusted code, it’s not allowed. InheritanceDemand of SafeHandle is: "for > full trust for inheritors. This member cannot be inherited by partially > trusted code." > https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.safehandle?view=netframework-4.8 > > I had a try to create my own class which inherited from SafeHandle. And, I > tryed to new an instance of this class. When code run in Partial Trust, the > same error pop up. What I am thinking the SafeHandle is the root reason > cause this problem. > > //the code is super simple, I just try to create a channel on a > constructor. public class WriterClient { private Channel _channel; private > LoggingCenter _logger; public WriterClient(int port, ILogging logger) { > _logger = logger == null? new LoggingCenter(new NullLogger()): new > LoggingCenter(logger); //when run in Partial Trust, the code below will > throw an exception. _channel = new Channel("127.0.0.1", port, > ChannelCredentials.Insecure); } > > What I am wanted is to call Grpc service correctly in Partial Trust. Any > workaround for it? > > -- > 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/67c0f691-6431-4722-951c-2f8dd8b6489b%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/67c0f691-6431-4722-951c-2f8dd8b6489b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Jan -- 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/CACF4M0QX4J8ZXbKgAv4ngvChm0tBJHFbDhNAyPC_7SEHNXfSeg%40mail.gmail.com.
smime.p7s
Description: S/MIME Cryptographic Signature
