Skip to content

I am Getting Cannot instantiate implementation type 'System.Net.Http.IHttpClientFactory' for service type 'System.Net.Http.IHttpClientFactory'. Error, #25

Open

Description

@muzammil001

blazor.webassembly.js:1 System.AggregateException: One or more errors occurred. (Cannot instantiate implementation type 'System.Net.Http.IHttpClientFactory' for service type 'System.Net.Http.IHttpClientFactory'.)
---> System.ArgumentException: Cannot instantiate implementation type 'System.Net.Http.IHttpClientFactory' for service type 'System.Net.Http.IHttpClientFactory'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.Populate()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory..ctor(ICollection1 descriptors) at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection1 serviceDescriptors, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, Boolean validateScopes)
at Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder.<>c__DisplayClass5_0.<.ctor>b__0()
at Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder.Build()
at Program.

$(String[] args) in D:\Software Projects\Tutorials\GoogleApiBlazor\GoogleApiBlazor\Program.cs:line 13
--- End of inner exception stack trace ---

Activity

  1. mckaragoz commented on Jul 16, 2023

    @mckaragoz
    Contributor

    Did you look at readme? You need to add builder.Services.AddCodeBeamGoogleApiServices(); in program.cs

  2. muzammil001 commented on Jul 16, 2023

    @muzammil001
    Author

    I did. It doesn't work.

  3. muzammil001 commented on Jul 16, 2023

    @muzammil001
    Author

    can you make a tutorial video of this? that how does this work?

  4. muzammil001 commented on Jul 16, 2023

    @muzammil001
    Author

    GoogleApiBlazor.zip

    here's my code. please review it.

  5. mckaragoz commented on Jul 16, 2023

    @mckaragoz
    Contributor

    GoogleApiBlazor.zip

    here's my code. please review it.

    Find a solution. Add builder.Services.AddHttpClient(); into you program.cs

  6. muzammil001 commented on Jul 16, 2023

    @muzammil001
    Author

    I've added this, but it showing me same error.

  7. mckaragoz commented on Jul 16, 2023

    @mckaragoz
    Contributor

    I've added this, but it showing me same error.

    Your project works on my computer. Remove the injection in Imports.razor and add into pages individually.

  8. muzammil001 commented on Jul 16, 2023

    @muzammil001
    Author

    It works thanks, but I got another error.
    Screenshot 2023-07-17 004708

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions