Skip to content

add new Abp module to my solution #4679

@mohammed-hussein

Description

@mohammed-hussein

Hello,

I have created a new project for infrastructure under ABP solution which will contain integration with external APIs, in this project I have created new module class inherit from ABPModule and another class for a custom repository to communicate with external APIs but ABP framework not loading my project 'Infrastructure' while booted and not finding my custom repo as well.

Here my module code

namespace STCS.Framework.Infrastructure
{
   [DependsOn(
       typeof(FrameworkDomainModule),
       typeof(AbpAutofacModule),
       typeof(AbpAutoMapperModule)
       )]
   public class FrameworkInfrastructureModule: AbpModule
   {
       public override void ConfigureServices(ServiceConfigurationContext context)
       {
           context.Services.AddApplication<FrameworkInfrastructureModule>(options =>{
               options.UseAutofac();
           });

           context.Services.AddTransient(typeof(TaskRepository), typeof(ITaskRepository));

           context.Services.AddAutoMapperObjectMapper<FrameworkInfrastructureModule>();
           Configure<AbpAutoMapperOptions>(options => {
               options.AddMaps<FrameworkInfrastructureModule>();
               //options.AddProfile<FrameworkInfrastructureAutoMapperProfile>(validate: true);
           });
       }
   }
}
  • I'm using ABP Framework version 2.8
  • Exception message and stack trace
An exception was thrown while activating Castle.Proxies.TasksAppServiceProxy.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Castle.Proxies.TasksAppServiceProxy.
 ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Castle.Proxies.TasksAppServiceProxy' can be invoked with the available services and parameters:
Cannot resolve parameter 'STCS.Framework.Repositories.ITaskRepository repository' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], STCS.Framework.Repositories.ITaskRepository)'.
   at Autofac.Core.Activators.Reflection.ReflectionActivator.GetValidConstructorBindings(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters, Object& decoratorTarget)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters, Object& decoratorTarget)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext)
   at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions