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?
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?