-
Notifications
You must be signed in to change notification settings - Fork 13
Description
I'm not sure if the version upgrade arose the problem, so I want someone to help me.
perhaps, I should upgrade my codes according to the newest version. Who can show me some newer code to replace it? Thanks
Could not load type 'ServiceModel.Grpc.Client.Internal.IClientBuilder`1' from assembly 'ServiceModel.Grpc, Version=1.21.0.0, Culture=neutral, PublicKeyToken=ba2245ad9cab75c7'.
at ServiceModel.Grpc.Client.DependencyInjection.Internal.ClientFactoryBuilder.AddClientCore[TContract](ClientResolver1 client, IClientBuilder1 builder, Action2 configure, IChannelProvider channel) at ServiceModel.Grpc.Client.DependencyInjection.Internal.ClientFactoryBuilder.AddClient[TContract](Action2 configure, IChannelProvider channel)
at EXOM.AppClient.BuildWithGrpcNetChannel()
my BuildWithGrpcNetChannel code:
private static ServiceProvider BuildWithGrpcNetChannel()
{
var services = new ServiceCollection();
_ = services.AddUserProvider();
var httpsHandler = new SocketsHttpHandler
{
SslOptions = new SslClientAuthenticationOptions
{
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
}
};
// Grpc.Net.Client.GrpcChannel
_ = services.AddSingleton(_ =>
GrpcChannel.ForAddress(_serverAddress, new GrpcChannelOptions()
{
HttpHandler = httpsHandler,
MaxSendMessageSize = (4 * 1024 * 1024) * 100,
MaxReceiveMessageSize = (4 * 1024 * 1024) * 100,
})
.Intercept(new ClientLoggerInterceptor(Logger, new UserInfoProvider())));
_ = services
.AddTokenProvider()
.AddServiceModelGrpcClientFactory()
.AddClient()
.AddClient()
.AddClient();//throw exception in this line
return services.BuildServiceProvider();
}