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

Posted

技术标签:

【中文标题】Abp.io 异常:激活 Castle.Proxies.ProcessesServiceProxy 时引发异常【英文标题】:Abp.io Exception: An exception was thrown while activating Castle.Proxies.ProcessesServiceProxy 【发布时间】:2020-02-07 19:45:11 【问题描述】:

我还是 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】:

我能说什么!在AutoFac 错误和其他一些事情之间跳了一整夜之后。我发布了这个问题,并开始关闭我的研究浏览器选项卡。我找到了这个 ☹️Github sample☹️ 所以整个诀窍就在这里。

options.AddDefaultRepositories(includeAllEntities: true);

请在文档中包含此提示。

【讨论】:

他们可能不会看到你的建议,最好contact them directly。

以上是关于Abp.io 异常:激活 Castle.Proxies.ProcessesServiceProxy 时引发异常的主要内容,如果未能解决你的问题,请参考以下文章

更改 ABP.IO 的表前缀和架构

abp.io - 扩展用户配置文件

用于制作此文档的工具是啥? https://docs.abp.io/en/abp/latest

在从 UI (ABP.IO) 创建租户的过程中创建新角色(通过代码)

我如何将带有数据的模型从数据库传递到 ABP.IO 布局挂钩?

ABP.io 角度无法读取未定义的属性替换