Есть ли у Autofac ограничения на то, сколько компонентов может быть зарегистрировано?C#

Место общения программистов C#
Ответить
Anonymous
 Есть ли у Autofac ограничения на то, сколько компонентов может быть зарегистрировано?

Сообщение Anonymous »

У нас есть большое решение с 24 проектами, в которых используется AutofaC (v3.5.2) и в значительной степени конструктор DI для построения всех наших услуг. В достижении предела. Недавно я добавил еще несколько конструкторов в существующую службу, и когда я загружаю и запускаю проект, я теперь получаю OutofmemoryException. Если я удалю эти новые DIS в этой службе, проект снова загружается. Вопрос в том, есть ли у Autofac такой тип предела? Если нет, то что может вызвать это OutOfMemoryException?
[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
Autofac.Core.Activators.Reflection.AutowiringParameter.CanSupplyValue(ParameterInfo pi, IComponentContext context, Func`1& valueProvider) +246
Autofac.Core.Activators.Reflection.ConstructorParameterBinding..ctor(ConstructorInfo ci, IEnumerable`1 availableParameters, IComponentContext context) +435
Autofac.Core.Activators.Reflection.c__DisplayClass13_0.b__0(ConstructorInfo ci) +67
System.Linq.WhereSelectArrayIterator`2.MoveNext() +58
System.Linq.WhereEnumerableIterator`1.MoveNext() +174
System.Linq.Buffer`1..ctor(IEnumerable`1 source) +135
System.Linq.Enumerable.ToArray(IEnumerable`1 source) +79
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +518
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124

[DependencyResolutionException:
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (ReflectionActivator),
Services = [MyCoolApp.Domain.IUserRetriever],
Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None,
Ownership = OwnedByLifetimeScope ---> Exception of type 'System.OutOfMemoryException' was thrown. (See inner exception for details.)]
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +274
Autofac.Core.Resolving.InstanceLookup.Execute() +341
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +281
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +72
Autofac.Core.Registration.c__DisplayClass2_0.b__2(IComponentContext c, IEnumerable`1 p) +57
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +188
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124

[DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (DelegateActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (ReflectionActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> Exception of type 'System.OutOfMemoryException' was thrown. (See inner exception for details.) (See inner exception for details.)]
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +274
Autofac.Core.Resolving.InstanceLookup.Execute() +341
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +281
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +72
Autofac.Core.Activators.Reflection.c__DisplayClass0_0.b__0() +82
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +328
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +622
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124

[DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserService (ReflectionActivator), Services = [MyCoolApp.Domain.Users.IUserService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (DelegateActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (ReflectionActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> Exception of type 'System.OutOfMemoryException' was thrown. (See inner exception for details.) (See inner exception for details.) (See inner exception for details.)]
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +274
Autofac.Core.Resolving.InstanceLookup.Execute() +341
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +281
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +72
Autofac.Core.Registration.c__DisplayClass2_0.b__2(IComponentContext c, IEnumerable`1 p) +57
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +188
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124

[DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserService (DelegateActivator), Services = [MyCoolApp.Domain.Users.IUserService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserService (ReflectionActivator), Services = [MyCoolApp.Domain.Users.IUserService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (DelegateActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = UserRetriever (ReflectionActivator), Services = [MyCoolApp.Domain.IUserRetriever], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> Exception of type 'System.OutOfMemoryException' was thrown. (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.)]
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +274
Autofac.Core.Resolving.InstanceLookup.Execute() +341
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +281
Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +72
Autofac.Core.Activators.Reflection.c__DisplayClass0_0.b__0() +82
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +328
Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +622
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +124
...
< /code>
Полный трассировка стека слишком большой, чтобы публиковать переполнение стека, но вы можете здесь полную трассу. зависимости, но не круговой. Каждый раз, когда мы загружаем приложение, ошибка следует за различной цепочкой зависимости в сообщениях об ошибках. Вот одна цепочка в качестве примера: < /p>
RelatedEntityResolver -> IPermissionService
RoleResolver -> IRelatedEntityResolver
-> IPermissionService
UserRetriever -> IRelatedEntityResolver
-> IRoleResolver
-> IPermissionService
UserService -> IUserRetriever
RoleService -> IPermissionService
-> IRoleResolver
-> IRelatedEntityResolver
-> IUserRetriever
-> IUserService
TeamFactory -> IPermissionService
-> IRoleService
TeamInstanceForCompetitionCreator -> ITeamFactory
CommandDispatcher -> ICommandHandler/ITeamInstanceForCompetitionCreator
CreateAgreement -> ICommandDispatcher


Подробнее здесь: https://stackoverflow.com/questions/794 ... registered
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»