Base solution for your next web application
Open Closed

Registering services #10133


User avatar
0
SBJ created
  • What is your product version? 8.7.0
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .NET Core

Hi,

We've currently set up an integrated Vue front-end as a separate C# project as part of the solution.

Everything is working as intended on the Vue side, but we're encountering problems registering services in general. We've set it up as follows:

  1. We've added an IFrontEndService and its implementation FrontEndService inside our project RMS.Web.Mvc. The interface inherits from IApplicationService and the implementation inherits from RMSApplicationBase, IFrontEndService
  2. Our front-end Vue project, RMS.Web.Website.Name, contains an ApiController that uses IoC to inject IFrontEndService.
  3. The Startup.cs of this front-end project registers IFrontEndService as Singleton.

However, after doing this, it still gives us the following error:

AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: RMS.Web.Mvc.Services.IFrontEndService Lifetime: Singleton ImplementationType: RMS.Web.Mvc.Services.FrontEndService': Unable to resolve service for type 'RMS.SBJ.CampaignProcesses.ICampaignsAppService' while attempting to activate 'RMS.Web.Mvc.Services.FrontEndService'.)

So, after that we decided to also register ICampaignsAppService, but then it starts "chaining" into more errors such as the IRepository<TK, TPK> entities that are injected into ICampaignsAppService's implementation, and so on and so on...

AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: RMS.SBJ.CampaignProcesses.ICampaignFormsAppService Lifetime: Singleton ImplementationType: RMS.SBJ.CampaignProcesses.CampaignFormsAppService': Unable to resolve service for type 'Abp.Domain.Repositories.IRepository`2[RMS.SBJ.CampaignProcesses.CampaignForm,System.Int64]' while attempting to activate 'RMS.SBJ.CampaignProcesses.CampaignFormsAppService'.) (Error while validating the service descriptor 'ServiceType: RMS.SBJ.CampaignProcesses.ICampaignsAppService Lifetime: Singleton ImplementationType: RMS.SBJ.CampaignProcesses.CampaignsAppService': Unable to resolve service for type 'Abp.Domain.Repositories.IRepository`2[RMS.SBJ.CampaignProcesses.Campaign,System.Int64]' while attempting to activate 'RMS.SBJ.CampaignProcesses.CampaignsAppService'.) (Error while validating the service descriptor 'ServiceType: RMS.Web.Mvc.Services.IFrontEndService Lifetime: Singleton ImplementationType: RMS.Web.Mvc.Services.FrontEndService': Unable to resolve service for type 'Abp.Domain.Repositories.IRepository`2[RMS.SBJ.CampaignProcesses.Campaign,System.Int64]' while attempting to activate 'RMS.SBJ.CampaignProcesses.CampaignsAppService'.)

Is there a way to register the IFrontEndService without having to also manually register every single injection present in every app service that the IFrontEndService will eventually use? Because that would mean literally having to register every single app service that is ever used, and also every IRepository's inserted type (which are entities, not even services).

Any help would be appreciated.


1 Answer(s)
  • User Avatar
    0
    musa.demir created

    Hi @SBJ, Can you please share your service's constructor method?