Abp.io异常:激活Castle.Proxies.ProcessesServiceProxy时引发了异常

时间:2019-10-10 11:15:41

标签: asp.net-core autofac abp

我对Abp.io还是陌生的,并且遇到了以下异常。 我按照Abp.io文档中的说明进行操作。 请您帮我知道我想念的是什么。

2019-10-10 14:01:46.644 +03:00 [ERR] An exception was thrown while activating Castle.Proxies.ProcessesServiceProxy.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Castle.Proxies.ProcessesServiceProxy. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Castle.Proxies.ProcessesServiceProxy' can be invoked with the available services and parameters:
Cannot resolve parameter 'Volo.Abp.Domain.Repositories.IRepository`2[AIL.WorkflowEngine.Processes.Process,System.Int32] repository' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], Volo.Abp.Domain.Repositories.IRepository`2[AIL.WorkflowEngine.Processes.Process,System.Int32])'.
   at Autofac.Core.Activators.Reflection.ReflectionActivator.GetValidConstructorBindings(IComponentContext context, IEnumerable`1 parameters) in C:\projects\autofac\src\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 160
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in C:\projects\autofac\src\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 120
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters, Object& decoratorTarget) in C:\projects\autofac\src\Autofac\Core\Resolving\InstanceLookup.cs:line 117
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters, Object& decoratorTarget) in C:\projects\autofac\src\Autofac\Core\Resolving\InstanceLookup.cs:line 135
   at Autofac.Core.Resolving.InstanceLookup.Execute() in C:\projects\autofac\src\Autofac\Core\Resolving\InstanceLookup.cs:line 83
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in C:\projects\autofac\src\Autofac\Core\Resolving\ResolveOperation.cs:line 131
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) in C:\projects\autofac\src\Autofac\Core\Resolving\ResolveOperation.cs:line 84
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) in C:\projects\autofac\src\Autofac\ResolutionExtensions.cs:line 1041
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) in C:\projects\autofac\src\Autofac\ResolutionExtensions.cs:line 871
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   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.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
2019-10-10 14:01:46.645 +03:00 [ERR] ---------- Exception Data ----------
2019-10-10 14:01:46.645 +03:00 [ERR] ActivatorChain = Castle.Proxies.ProcessesServiceProxy
2019-10-10 14:01:46.645 +03:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'.
2019-10-10 14:01:46.646 +03:00 [INF] Executed action AIL.WorkflowEngine.Processes.ProcessesService.GetListAsync (AIL.WorkflowEngine.Application) in 4.636ms
2019-10-10 14:01:46.646 +03:00 [INF] Request finished in 9.6394ms 500 application/json; charset=utf-8

我也已经打过UseAutofac

services.AddApplication<TrisWebUnifiedModule>(options =>
{
    options.UseAutofac();
});

1 个答案:

答案 0 :(得分:2)

我能说什么!经过一整夜,在AutoFac错误和其他一些错误之间跳来跳去。我发布了这个问题,并开始关闭我的研究浏览器标签。我找到了这个 ☹️Github sample☹️ 所以整个技巧就在这里。

options.AddDefaultRepositories(includeAllEntities: true);

请在文档中包含此提示。