Open Closed

Method not found: 'System.Nullable`1<System.Guid> Volo.Abp.IdentityServer.Clients.Client.get_TenantId()'. #2851


User avatar
0
Rajasekhar created
  • ABP Framework version: 5.1.4
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hi I am trying to customize the identity server module to multitenant support. I have added the domain,domain.shared and ef modules. then removed the ignoremultitenancy support attribute from IdentityServerDbContext.

And I have added IMultiTenant to all entities related to Identityserver like clients,apiresources entities and also mapped the tenant attribute in IdentityServerDbContextModelCreatingExtensions.cs

then I am trying to do the migration using dbcontext getting below error,

Method not found: 'System.Nullable`1<System.Guid> Volo.Abp.IdentityServer.Clients.Client.get_TenantId()'.

Please help me for this issue


23 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share full error stack?

  • User Avatar
    0
    Rajasekhar created

    add-migration updatedthe_entiets -context XSenseOne.EntityFrameworkCore.XSenseOneDbContext

    [19:20:13 INF] Starting web host.
    [19:20:15 FTL] Host terminated unexpectedly!
    Microsoft.Extensions.Hosting.HostFactoryResolver+HostingListener+StopTheHostException: Exception of type 'Microsoft.Extensions.Hosting.HostFactoryResolver+HostingListener+StopTheHostException' was thrown.
       at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.OnNext(KeyValuePair`2 value)
       at System.Diagnostics.DiagnosticListener.Write(String name, Object value)
       at Microsoft.Extensions.Hosting.HostBuilder.Build()
       at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
       at XSenseOne.Web.Program.Main(String[] args) in D:\Ensurity\XSense_One\XSenseOne\src\XSenseOne.Web\Program.cs:line 39
    System.MissingMethodException: Method not found: 'System.Nullable`1<System.Guid> Volo.Abp.IdentityServer.Clients.Client.get_TenantId()'.
       at Volo.Abp.IdentityServer.EntityFrameworkCore.IdentityServerDbContextModelCreatingExtensions.<>c.<ConfigureIdentityServer>b__0_0(EntityTypeBuilder`1 b)
       at Microsoft.EntityFrameworkCore.ModelBuilder.Entity[TEntity](Action`1 buildAction)
       at Volo.Abp.IdentityServer.EntityFrameworkCore.IdentityServerDbContextModelCreatingExtensions.ConfigureIdentityServer(ModelBuilder builder) in D:\Ensurity\XSense_One\XSenseOne\modules\Volo.Identityserver.Ui\src\Volo.Abp.IdentityServer.EntityFrameworkCore\Volo\Abp\IdentityServer\EntityFrameworkCore\IdentityServerDbContextModelCreatingExtensions.cs:line 23
       at XSenseOne.EntityFrameworkCore.XSenseOneDbContext.OnModelCreating(ModelBuilder builder) in D:\Ensurity\XSense_One\XSenseOne\src\XSenseOne.EntityFrameworkCore\EntityFrameworkCore\XSenseOneDbContext.cs:line 146
       at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.Customize(ModelBuilder modelBuilder, DbContext context)
       at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, ModelDependencies modelDependencies)
       at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, ModelCreationDependencies modelCreationDependencies, Boolean designTime)
       at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel(Boolean designTime)
       at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
       at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__8_4(IServiceProvider p)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
       at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
       at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
       at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
       at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
       at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
       at Microsoft.EntityFrameworkCore.DbContext.get_ContextServices()
       at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
       at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance()
       at Microsoft.EntityFrameworkCore.Infrastructure.Internal.InfrastructureExtensions.GetService[TService](IInfrastructure`1 accessor)
       at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor)
       at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(Func`1 factory)
       at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
       at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType, String namespace)
       at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType, String namespace)
       at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigration.&lt;&gt;c__DisplayClass0_0.&lt;.ctor&gt;b__0()
       at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.&lt;&gt;c__DisplayClass3_0`1.<Execute>b__0()
       at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
    Method not found: 'System.Nullable`1&lt;System.Guid&gt; Volo.Abp.IdentityServer.Clients.Client.get_TenantId()'.
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    This Volo.Abp.IdentityServer.EntityFrameworkCore.IdentityServerDbContextModelCreatingExtensions method is executed.

    Maybe you should use your custom ModelCreatingExtensions.

  • User Avatar
    0
    Rajasekhar created

    Can you give me any example

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You can copy the code of IdentityServerDbContextModelCreatingExtensions and remove IsTenantOnlyDatabase.

    ConfigureMyIdentityServer
    
  • User Avatar
    0
    Rajasekhar created

    I have remove that one. do you mean i need to maintain two methods?

    ConfigureIdentityServer and ConfigureMyIdentityServer?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Can you share a **simple project **to reproduce the problem? liming.ma@volosoft.com

  • User Avatar
    0
    Rajasekhar created

    I will Send

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks

  • User Avatar
    0
    Rajasekhar created

    Mail Sent

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I have change the ConfigureMyIdentityServer to ConfigureIdentityServer and try to add migrations, it works.

  • User Avatar
    0
    Rajasekhar created

    Please give me that zip file once

  • User Avatar
    0
    Rajasekhar created

    After successful migration I am trying to run this application getting same error

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I sent you a working project.

  • User Avatar
    0
    Rajasekhar created

    is it working your side? i mean you are able to login

  • User Avatar
    0
    Rajasekhar created

    Yes its working my end also thanks for your support

  • User Avatar
    0
    Rajasekhar created

    I have one doubt is it working for multitenant(add and remove identity server supported clients)?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    There is no problem with multi-tenant design, you can try it.

  • User Avatar
    0
    Rajasekhar created

    There is no problem with multi-tenant design, you can try it.

    can you give me one more input. what i missed in my implementation. Your inputs very help us

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    What problem/error are you having now?

  • User Avatar
    0
    Rajasekhar created

    After successful migration I am trying to run this application getting same error

    What are changes you are done for fixing my problem? and What is missed?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Check your csproj files and remove references Volo.Abp.IdentityServer.xxx v5.1.4 using the ProjectReference

  • User Avatar
    0
    Rajasekhar created

    Thanks

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11