Skip to content

Question: Could not load type 'ServiceModel.Grpc.Client.Internal.IClientBuilder. Exception happens when I upgrade 1.8.2 to 1.21 #414

@yaugkeer

Description

@yaugkeer

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();
}

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions