Receiving error: Method 'FindIdentityResourcesByScopeNameAsync' does not have an implementation

1

I'm attempting to execute the following:

        var builder = services.AddIdentityServer(
                options => { options.IssuerUri = "https://boo.com"; })
            .AddExtensionGrantValidator<LPDelegationGrantValidator>()
            .AddProfileService<ONBProfileService>()

            .AddOperationalStore(options =>
            {
                options.ConfigureDbContext = b =>
                {
                    b.UseSqlServer(connectionString, db => db.MigrationsAssembly(migrationsAssembly));
                };
            })
            .AddConfigurationStore(options =>
            {
                options.ConfigureDbContext = b =>
                {
                    b.UseSqlServer(connectionString, db => db.MigrationsAssembly(migrationsAssembly));
                };
            });

This used to work but then I moved the solution to a different location and renamed some of my projects. Now it's crashing with the the following error.

I've tried aligning the versions of the packages I'm referencing to v3.1.3 but it's not fixing this.

Is there a straight-forward way to resolve this?

System.TypeLoadException
    HResult=0x80131522
    Message=Method 'FindIdentityResourcesByScopeNameAsync' in type 'IdentityServer4.EntityFramework.Stores.ResourceStore' from assembly 'IdentityServer4.EntityFramework.Storage, Version=3.1.3.0, Culture=neutral, PublicKeyToken=f294d0afe402bb2b' does not have an implementation.
    Source=IdentityServer4.EntityFramework
    StackTrace:
    at Microsoft.Extensions.DependencyInjection.IdentityServerEntityFrameworkBuilderExtensions.AddConfigurationStore[TContext](IIdentityServerBuilder builder, Action`1 storeOptionsAction)
    at Microsoft.Extensions.DependencyInjection.IdentityServerEntityFrameworkBuilderExtensions.AddConfigurationStore(IIdentityServerBuilder builder, Action`1 storeOptionsAction)
    at IdSrv_Host_Console.Startup.GetSqlConfigurationBuilder(IServiceCollection services) in C:\Workspace\dev\live-person-sts-id4\IdentityServer4\Bupa_src\Idsrv_Host_Console\Startup.cs:line 75
    at IdSrv_Host_Console.Startup.ConfigureServices(IServiceCollection services) in C:\Workspace\dev\live-person-sts-id4\IdentityServer4\Bupa_src\Idsrv_Host_Console\Startup.cs:line 49
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
    at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass15_0.<BuildStartupServicesFilterPipeline>g__RunPipeline|0(IServiceCollection services)
    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
    at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass14_0.<ConfigureServices>g__ConfigureServicesWithContainerConfiguration|0(IServiceCollection services)
    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
identityserver4
asked on Stack Overflow Apr 29, 2020 by DaveDev

1 Answer

1

I faced the same issue when refactored my solution and extracted my DbContext into a separate project. This GitHub issue discussion helped me to fix that: Check that IdentityServer4.EntityFramework.Storage v3.1.3 is installed.

As you mentioned in your question you've already did that but in my case I had different versions in the original ASP.NET application and in the project I've extracted my DbContext to - there NuGet package was resolved with the latest v4.0.2 which caused incompatibility and runtime exception.

Hope that will help!

answered on Stack Overflow Jul 15, 2020 by Nozim Turakulov

User contributions licensed under CC BY-SA 3.0