Base solution for your next web application
Open Closed

BackgroundJobStore injection #1639


User avatar
0
mbit created

Hi,

i just want to implement a service that starts some background jobs via hangfire, so i do:

public class MeEmailService : MeAppServiceBase, IMeEmailService
	{
		protected IMeEmailSendService _SendService;
		protected readonly ITenantSettingsAppService _TenantSettingsAppService;
		protected readonly IBackgroundJobManager _backgroundJobManager;

		public MeEmailService(ITenantSettingsAppService TenantSettingsAppService, IBackgroundJobManager backgroundJobManager)
		{
			_TenantSettingsAppService = TenantSettingsAppService;
			_backgroundJobManager = backgroundJobManager;
...

But somthing is missing, because i get this error at runtime: An error has occurred.","exceptionMessage":"Can't create component 'Abp.BackgroundJobs.BackgroundJobStore' as it has dependencies to be satisfied.\r\n\r\n'Abp.BackgroundJobs.BackgroundJobStore' is waiting for the following dependencies:\r\n- Service 'Abp.Domain.Repositories.IRepository`2[[Abp.BackgroundJobs.BackgroundJobInfo, Abp, Version=0.11.1.0, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.

any hint for me what i am missing?

best regards Martin


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Did you made any changes on DbContext (or DbContexts if you have more than one) ? It might be related to that.

  • User Avatar
    0
    mbit created

    Hi,

    i added some custom entities like that:

    namespace xxx.EntityFramework
    {
        public class MeDbContext : AbpZeroDbContext<Tenant, Role, User>
        {
            /* Define an IDbSet for each entity of the application */
            public virtual IDbSet<MeLogEntry> MeLogEntries { get; set; }
    		public virtual IDbSet<MeApiKey> MeApiKeys { get; set; }
    		public virtual IDbSet<MeBlacklist> MeBlackLists { get; set; }
    ...
    
  • User Avatar
    0
    mbit created

    Hi,

    same problem when i try to inject the TenantAppService:

    Can't create component '_1701apps.effairs.MultiTenancy.TenantManager' as it has dependencies to be satisfied.

    '_1701apps.effairs.MultiTenancy.TenantManager' is waiting for the following dependencies:

    • Service 'Abp.Domain.Repositories.IRepository`1[[_1701apps.effairs.MultiTenancy.Tenant, _1701apps.effairs.Core, Version=1.2.19.77, Culture=neutral, PublicKeyToken=null]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.MultiTenancy.TenantFeatureSetting, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service '_1701apps.effairs.Editions.EditionManager' which was registered but is also waiting for dependencies. '_1701apps.effairs.Editions.EditionManager' is waiting for the following dependencies:
    • Service 'Abp.Domain.Repositories.IRepository`1[[Abp.Application.Editions.Edition, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null]]' which was not registered.
    • Service 'AbpZeroFeatureValueStore' which was registered but is also waiting for dependencies. 'AbpZeroFeatureValueStore' is waiting for the following dependencies:
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.MultiTenancy.TenantFeatureSetting, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`1[[_1701apps.effairs.MultiTenancy.Tenant, _1701apps.effairs.Core, Version=1.2.19.77, Culture=neutral, PublicKeyToken=null]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Application.Features.EditionFeatureSetting, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service '_1701apps.effairs.Authorization.Roles.RoleManager' which was registered but is also waiting for dependencies. '_1701apps.effairs.Authorization.Roles.RoleManager' is waiting for the following dependencies:
    • Service '_1701apps.effairs.Authorization.Roles.RoleStore' which was registered but is also waiting for dependencies. '_1701apps.effairs.Authorization.Roles.RoleStore' is waiting for the following dependencies:
    • Service 'Abp.Domain.Repositories.IRepository`1[[_1701apps.effairs.Authorization.Roles.Role, _1701apps.effairs.Core, Version=1.2.19.77, Culture=neutral, PublicKeyToken=null]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Authorization.Users.UserRole, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Authorization.Roles.RolePermissionSetting, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service '_1701apps.effairs.Authorization.Users.UserEmailer' which was registered but is also waiting for dependencies. '_1701apps.effairs.Authorization.Users.UserEmailer' is waiting for the following dependencies:
    • Service 'Abp.Domain.Repositories.IRepository`1[[_1701apps.effairs.MultiTenancy.Tenant, _1701apps.effairs.Core, Version=1.2.19.77, Culture=neutral, PublicKeyToken=null]]' which was not registered.
    • Service '_1701apps.effairs.MultiTenancy.Demo.TenantDemoDataBuilder' which was registered but is also waiting for dependencies. '_1701apps.effairs.MultiTenancy.Demo.TenantDemoDataBuilder' is waiting for the following dependencies:
    • Service 'Abp.Organizations.OrganizationUnitManager' which was registered but is also waiting for dependencies. 'Abp.Organizations.OrganizationUnitManager' is waiting for the following dependencies:
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Organizations.OrganizationUnit, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service '_1701apps.effairs.Authorization.Users.UserManager' which was registered but is also waiting for dependencies. '_1701apps.effairs.Authorization.Users.UserManager' is waiting for the following dependencies:
    • Service '_1701apps.effairs.Authorization.Users.UserStore' which was registered but is also waiting for dependencies. '_1701apps.effairs.Authorization.Users.UserStore' is waiting for the following dependencies:
    • Service 'Abp.Domain.Repositories.IRepository`2[[_1701apps.effairs.Authorization.Users.User, _1701apps.effairs.Core, Version=1.2.19.77, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Authorization.Users.UserLogin, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Authorization.Users.UserRole, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`1[[_1701apps.effairs.Authorization.Roles.Role, _1701apps.effairs.Core, Version=1.2.19.77, Culture=neutral, PublicKeyToken=null]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Authorization.Users.UserPermissionSetting, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service '_1701apps.effairs.Authorization.Roles.RoleManager' which was registered but is also waiting for dependencies.- Service 'Abp.Domain.Repositories.IRepository`1[[_1701apps.effairs.MultiTenancy.Tenant, _1701apps.effairs.Core, Version=1.2.19.77, Culture=neutral, PublicKeyToken=null]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Organizations.OrganizationUnit, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Authorization.Users.UserOrganizationUnit, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Authorization.Users.UserLoginAttempt, Abp.Zero, Version=0.11.0.2, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service '_1701apps.effairs.Storage.DbBinaryObjectManager' which was registered but is also waiting for dependencies. '_1701apps.effairs.Storage.DbBinaryObjectManager' is waiting for the following dependencies:
    • Service 'Abp.Domain.Repositories.IRepository`2[[_1701apps.effairs.Storage.BinaryObject, _1701apps.effairs.Core, Version=1.2.19.77, Culture=neutral, PublicKeyToken=null],[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service '_1701apps.effairs.Authorization.Users.UserManager' which was registered but is also waiting for dependencies.- Service 'Abp.Notifications.NotificationSubscriptionManager' which was registered but is also waiting for dependencies. 'Abp.Notifications.NotificationSubscriptionManager' is waiting for the following dependencies:
    • Service 'Abp.Notifications.NotificationStore' which was registered but is also waiting for dependencies. 'Abp.Notifications.NotificationStore' is waiting for the following dependencies:
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Notifications.NotificationInfo, Abp, Version=0.11.1.0, Culture=neutral, PublicKeyToken=null],[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Notifications.TenantNotificationInfo, Abp, Version=0.11.1.0, Culture=neutral, PublicKeyToken=null],[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Notifications.UserNotificationInfo, Abp, Version=0.11.1.0, Culture=neutral, PublicKeyToken=null],[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.Notifications.NotificationSubscriptionInfo, Abp, Version=0.11.1.0, Culture=neutral, PublicKeyToken=null],[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service '_1701apps.effairs.Notifications.AppNotifier' which was registered but is also waiting for dependencies. '_1701apps.effairs.Notifications.AppNotifier' is waiting for the following dependencies:
    • Service 'Abp.Notifications.NotificationPublisher' which was registered but is also waiting for dependencies. 'Abp.Notifications.NotificationPublisher' is waiting for the following dependencies:
    • Service 'Abp.Notifications.NotificationStore' which was registered but is also waiting for dependencies.- Service 'Abp.BackgroundJobs.BackgroundJobManager' which was registered but is also waiting for dependencies. 'Abp.BackgroundJobs.BackgroundJobManager' is waiting for the following dependencies:
    • Service 'Abp.BackgroundJobs.BackgroundJobStore' which was registered but is also waiting for dependencies. 'Abp.BackgroundJobs.BackgroundJobStore' is waiting for the following dependencies:
    • Service 'Abp.Domain.Repositories.IRepository`2[[Abp.BackgroundJobs.BackgroundJobInfo, Abp, Version=0.11.1.0, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
    • Service 'Abp.Notifications.NotificationDistributer' which was registered but is also waiting for dependencies. 'Abp.Notifications.NotificationDistributer' is waiting for the following dependencies:
    • Service 'Abp.Notifications.NotificationStore' which was registered but is also waiting for dependencies.- Service 'AbpZeroFeatureValueStore' which was registered but is also waiting for dependencies.- Service 'Abp.MultiTenancy.IAbpZeroDbMigrator' which was not registered.

    I use the top-service (emailservice, wich then uses tenant an jobservice) from a ApiController - maybe this matters?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Did you override OnModelCreating of your DbContext ?

    This entity, BackgroundJobInfo, is defined in Abp.Zero package and it should be in the DbContext by default because you derive your DbContext from AbpZeroDbContext.

  • User Avatar
    0
    mbit created

    Hi,

    i did not override OnModelCreating.

    May it cause a problem that in the .application Project is another dbcontext (for some legacy reasons - we migrate an existing web-app)?

    thanks for your help.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Yes, it might be related to that. Can you share it's definition as well ? We will try to simulate your case.