Ticket (Solved)

Autofac.Core.DependencyResolutionException

Hi!

I've got following error in my log. I would be appreciated for any thoughts about it.

Autofac.Core.DependencyResolutionException: None of the constructors found with 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFinderWrapper' on type 'Orchard.Security.Authorizer' can be invoked with the available services and parameters: Cannot resolve parameter 'Orchard.Security.IAuthorizationService authorizationService' of constructor 'Void .ctor(Orchard.Security.IAuthorizationService, Orchard.UI.Notify.INotifier, Orchard.IWorkContextAccessor)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 106 at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79 at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 270 at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64 at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123 at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ConstructorParameterBinding.cs:line 114 at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122 at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79 at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 270 at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64 at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123 at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ConstructorParameterBinding.cs:line 114 at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122 at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79 at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 270 at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64 at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123 at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ConstructorParameterBinding.cs:line 114 at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122 at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79 at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 270 at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64 at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123 at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Autofac.Features.Collections.CollectionRegistrationSource.<>cDisplayClass4.b0(IComponentContext c, IEnumerable1 p) in c:\Projects\OSS\autofac\Core\Source\Autofac\Features\Collections\CollectionRegistrationSource.cs:line 75 at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 69 at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79 at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 62 at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123 at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 69 at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79 at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 62 at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123 at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 94 at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 232 at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\ResolutionExtensions.cs:line 346 at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\ResolutionExtensions.cs:line 197 at Orchard.Environment.WorkContextImplementation..ctor(IComponentContext componentContext) in h:\work\Cabinet\src\Orchard\Environment\WorkContextImplementation.cs:line 15 at Orchard.Environment.WorkContextModule.<Load>b__0(IComponentContext ctx) in h:\work\Cabinet\src\Orchard\Environment\WorkContextModule.cs:line 19 at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass11.b0(IComponentContext c, IEnumerable1 p) in c:\Projects\OSS\autofac\Core\Source\Autofac\Builder\RegistrationBuilder.cs:line 36 at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 69 at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79 at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 270 at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64 at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123 at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 94 at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 232 at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\ResolutionExtensions.cs:line 346 at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\ResolutionExtensions.cs:line 197 at Orchard.Environment.WorkContextAccessor.HttpContextScopeImplementation..ctor(IEnumerable1 events, ILifetimeScope lifetimeScope, HttpContextBase httpContext, Object workContextKey) in h:\work\Cabinet\src\Orchard\Environment\WorkContextAccessor.cs:line 83 at Orchard.Environment.WorkContextAccessor.CreateWorkContextScope(HttpContextBase httpContext) in h:\work\Cabinet\src\Orchard\Environment\WorkContextAccessor.cs:line 48 at Orchard.Environment.WorkContextAccessor.CreateWorkContextScope() in h:\work\Cabinet\src\Orchard\Environment\WorkContextAccessor.cs:line 59 at Orchard.WorkContextExtensions.CreateWorkContextScope(ILifetimeScope lifetimeScope) in h:\work\Cabinet\src\Orchard\WorkContextExtensions.cs:line 84 at Orchard.Environment.ShellBuilders.ShellContextFactory.CreateShellContext(ShellSettings settings) in h:\work\Cabinet\src\Orchard\Environment\ShellBuilders\ShellContextFactory.cs:line 64 at Orchard.Environment.DefaultOrchardHost.CreateShellContext(ShellSettings settings) in h:\work\Cabinet\src\Orchard\Environment\DefaultOrchardHost.cs:line 190 at Orchard.Environment.DefaultOrchardHost.b7(ShellSettings settings) in h:\work\Cabinet\src\Orchard\Environment\DefaultOrchardHost.cs:line 140

Re: Autofac.Core.DependencyResolutionException

Impossible to tell what happened based on this, but can you blow away your App_Data folder and do a rebuild of the solution, then try again setting up the site? Can you share when this started happening, what you changes you have made, if any? Did this happen right after setting up a vanilla Orchard installation, or after you enabled a feature for example?

Monday, April 13, 2015 11:28:31 AM bysfmskywalker

Re: Autofac.Core.DependencyResolutionException

I still get this error with cleaned up App_Data folder, rebuild doesn't helps either.

No, this is not vanilla installation, I have a few custom modules installed.

Actually, in works fine until I cleaned Dependencies folder. Getting it contents files back from working installation doesn't helped.

Does this line "Cannot resolve parameter 'Orchard.Security.IAuthorizationService authorizationService' " mean, that autofac does not have registered the IAuthorizationService implementation?

Monday, April 13, 2015 1:08:51 PM bybonzaster

Re: Autofac.Core.DependencyResolutionException

That's what it means, but the question is what is causing that. I have seen similar errors, and the cause is always either something wrong with the build, or some exception occurring in a custom or third party module.

You could try removing your custom modules and then adding them back one by one so you can identify the culprit and go from there. What often helps me identifying this sort of issues is attaching a debugger - that oftentimes reveals much more details on what's really going on.

Monday, April 13, 2015 4:39:29 PM bysfmskywalker

Re: Autofac.Core.DependencyResolutionException

The cause of this issue was an adding a new parameter of IOrchardServices type into FormsAuthenticationService constructor. Could it lead to circular reference?

Tuesday, April 14, 2015 2:21:11 PM bybonzaster

Re: Autofac.Core.DependencyResolutionException

Quite possible, yes.

Tuesday, April 14, 2015 2:43:36 PM bysfmskywalker

Post a reply

You need to be signed in to post a reply.

Sign In