Starts in:
0 DAY
5 HRS
12 MIN
9 SEC
Starts in:
0 D
5 H
12 M
9 S
Open Closed

Can't inject commercial modules into a service in a console app. #1401


User avatar
0
broctune created
  • ABP Framework version: v4.2.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): Identity server separated
  • Exception message and stack trace:

System.InvalidOperationException HResult=0x80131509 Message=Unable to resolve service for type 'Volo.Abp.Identity.IIdentityUserRepository' while attempting to activate 'Volo.Abp.Identity.IdentityUserStore'. Source=Microsoft.Extensions.DependencyInjection StackTrace: at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.<>c__DisplayClass7_0.<GetCallSite>b__0(Type type) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.<>c__DisplayClass7_0.<GetCallSite>b__0(Type type) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.<>c__DisplayClass7_0.<GetCallSite>b__0(Type type) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.<>c__DisplayClass7_0.<GetCallSite>b__0(Type type) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor(Type serviceType) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.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 Tryl.eConsent.Program.Main(String[] args) in E:\GitHub\Tryl.Main\microservices\eConsent\test\Tryl.eConsent.HttpApi.Client.ConsoleTestApp\Program.cs:line 16

  • Steps to reproduce the issue:

Try to inject IProfileAppService into the ClientDemoService constructor of a fresh, new ConsoleTestApp project. I've added a reference to Volo.Abp.Identity.Pro.Application using the Abp Commercial Nuget server. I've added typeof(AbpIdentityApplicationModule) to the ...ConsoleApiClientModule class. The console app works as expected befroe adding the above changes. I've added our AbpLicenceCode to appsettings.json and tried including access-token.bin in the output directory.

I've created this simple example above because I have a more complex example that used to work and was used for creating demo data in our system. Now it fails with AutoFac errors similar to above (during constructor injection) when trying to launch.

Also, this is the 2nd time I tried to post this ticket but received an error the 1st time after completing the captcha.


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

    hi @broctune

    Can you share the project with me? liming.ma@volosoft.com

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    <PackageReference Include="Volo.Saas.EntityFrameworkCore" Version="4.3.0" />
    
    using Volo.Saas.EntityFrameworkCore;
    typeof(SaasEntityFrameworkCoreModule)
    
    Acme.MyConsoleApp>dotnet run
    [15:25:20 INF] Starting console host.
    [15:25:21 INF] Loaded ABP modules:
    [15:25:21 INF] - Acme.MyConsoleApp.MyConsoleAppModule
    [15:25:21 INF]   - Volo.Abp.Autofac.AbpAutofacModule
    [15:25:21 INF]     - Volo.Abp.Castle.AbpCastleCoreModule
    [15:25:21 INF]   - Volo.Saas.Host.SaasHostApplicationModule
    [15:25:21 INF]     - Volo.Saas.SaasDomainModule
    [15:25:21 INF]       - Volo.Abp.MultiTenancy.AbpMultiTenancyModule
    [15:25:21 INF]         - Volo.Abp.Data.AbpDataModule
    [15:25:21 INF]           - Volo.Abp.ObjectExtending.AbpObjectExtendingModule
    [15:25:21 INF]             - Volo.Abp.Localization.AbpLocalizationAbstractionsModule
    [15:25:21 INF]             - Volo.Abp.Validation.AbpValidationAbstractionsModule
    [15:25:21 INF]           - Volo.Abp.Uow.AbpUnitOfWorkModule
    [15:25:21 INF]           - Volo.Abp.EventBus.Abstractions.AbpEventBusAbstractionsModule
    [15:25:21 INF]         - Volo.Abp.Security.AbpSecurityModule
    [15:25:21 INF]       - Volo.Saas.SaasDomainSharedModule
    [15:25:21 INF]         - Volo.Abp.Localization.AbpLocalizationModule
    [15:25:21 INF]           - Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemModule
    [15:25:21 INF]           - Volo.Abp.Settings.AbpSettingsModule
    [15:25:21 INF]         - Volo.Abp.FeatureManagement.AbpFeatureManagementDomainSharedModule
    [15:25:21 INF]           - Volo.Abp.Validation.AbpValidationModule
    [15:25:21 INF]       - Volo.Abp.Domain.AbpDddDomainModule
    [15:25:21 INF]         - Volo.Abp.Auditing.AbpAuditingModule
    [15:25:21 INF]           - Volo.Abp.Json.AbpJsonModule
    [15:25:21 INF]             - Volo.Abp.Timing.AbpTimingModule
    [15:25:21 INF]           - Volo.Abp.Threading.AbpThreadingModule
    [15:25:21 INF]         - Volo.Abp.EventBus.AbpEventBusModule
    [15:25:21 INF]         - Volo.Abp.Guids.AbpGuidsModule
    [15:25:21 INF]         - Volo.Abp.ObjectMapping.AbpObjectMappingModule
    [15:25:21 INF]         - Volo.Abp.ExceptionHandling.AbpExceptionHandlingModule
    [15:25:21 INF]         - Volo.Abp.Specifications.AbpSpecificationsModule
    [15:25:21 INF]       - Volo.Abp.AutoMapper.AbpAutoMapperModule
    [15:25:21 INF]       - Volo.Abp.FeatureManagement.AbpFeatureManagementDomainModule
    [15:25:21 INF]         - Volo.Abp.Features.AbpFeaturesModule
    [15:25:21 INF]           - Volo.Abp.Authorization.AbpAuthorizationAbstractionsModule
    [15:25:21 INF]         - Volo.Abp.Caching.AbpCachingModule
    [15:25:21 INF]           - Volo.Abp.Serialization.AbpSerializationModule
    [15:25:21 INF]     - Volo.Saas.Host.SaasHostApplicationContractsModule
    [15:25:21 INF]
    Hello World!
    ]       - Volo.Abp.Application.AbpDddApplicationModule
    [15:25:21 INF]         - Volo.Abp.Application.AbpDddApplicationContractsModule
    [15:25:21 INF]         - Volo.Abp.Authorization.AbpAuthorizationModule
    [15:25:21 INF]         - Volo.Abp.Http.AbpHttpAbstractionsModule
    [15:25:21 INF]         - Volo.Abp.GlobalFeatures.AbpGlobalFeaturesModule
    [15:25:21 INF]       - Volo.Abp.FeatureManagement.AbpFeatureManagementApplicationContractsModule
    [15:25:21 INF]     - Volo.Abp.FeatureManagement.AbpFeatureManagementApplicationModule
    [15:25:21 INF]   - Volo.Saas.EntityFrameworkCore.SaasEntityFrameworkCoreModule
    [15:25:21 INF]     - Volo.Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule
    [15:25:21 INF]     - Volo.Abp.FeatureManagement.EntityFrameworkCore.AbpFeatureManagementEntityFrameworkCoreModule
    [15:25:21 INF] Initialized all ABP modules.
    [15:25:21 INF] Application started. Press Ctrl+C to shut down.
    [15:25:21 INF] Hosting environment: Production
    [15:25:21 INF] Content root path: Acme.MyConsoleApp
    
    
    
  • User Avatar
    0
    broctune created

    Adding the additional project reference via Nuget with the corresponding 'using' and 'typeof' statement resolved the issue is the Test project for me as well.

    In my real project I'm using several commercial modules which all have this problem. How can I tell which additional references need to be made to get those to work? The error message does not indicate which dependancy is missing, I haven't seen helpful information in any logs and I have not been able to find any other clues.

    Thanks Broctune

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Message=Unable to resolve service for type 'Volo.Abp.Identity.IIdentityUserRepository' while attempting to activate 'Volo.Abp.Identity.IdentityUserStore'.

    The IdentityUserStore service implementation is in the EF Core module.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06