Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grpc Error #4233

Closed
wisamidris7 opened this issue May 19, 2024 · 3 comments · Fixed by grpc/grpc-dotnet#2448
Closed

Grpc Error #4233

wisamidris7 opened this issue May 19, 2024 · 3 comments · Fixed by grpc/grpc-dotnet#2448

Comments

@wisamidris7
Copy link

Hello in aspire the ConfigureHttpClientDefaults is important for grpc and http for service discovery

Okay problem is the grpc no longer support ConfigureHttpClient or even ConfigureHttpClientDefaults
And i need the service discovery i said no problem i maked a custom uri or grpc with configuration

builder.Services.AddGrpcClient<...>(e => e.Uri = new Uri(builder.Configuration["MyServiceUrl"]));

This was gonna work but ConfigureHttpClientDefaults even go in to grpc so i have a lot of http client services discovery
And the best feature of aspire is services discovery it's 70% who made me upgrade my project to aspire

So can you explain how to fix it!

@wisamidris7
Copy link
Author

This is the exception
The ConfigureHttpClient method is not supported when creating gRPC clients.
And more details

Grpc.Net.ClientFactory.Internal.GrpcCallInvokerFactory.CreateInvoker(EntryKey key)
InvalidOperationException: The ConfigureHttpClient method is not supported when creating gRPC clients. Unable to create client with name 'InvoiceDetailsClient'.
Grpc.Net.ClientFactory.Internal.GrpcCallInvokerFactory.CreateInvoker(EntryKey key)
System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
Grpc.Net.ClientFactory.Internal.GrpcCallInvokerFactory.CreateInvoker(string name, Type type)
Grpc.Net.ClientFactory.Internal.DefaultGrpcClientFactory.CreateClient<TClient>(string name)
Microsoft.Extensions.DependencyInjection.GrpcClientServiceExtensions+<>c__DisplayClass7_0<TClient>.<AddGrpcHttpClient>b__2(IServiceProvider s)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<TArgument, TResult>.VisitCallSite(ServiceCallSite callSite, TArgument argument)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
lambda_method2(Closure , object , HttpContext )
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

@wisamidris7
Copy link
Author

I even updated all packages to the latest versions

@DamianEdwards
Copy link
Member

@JamesNK @ReubenBond

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants