Unable to setup orchard using command line (error executing command setup)

Topics: Installing Orchard, Troubleshooting
Jan 28, 2015 at 11:02 AM
Hi,

I'm trying å setup orchard 1.8.1 (source) using the command line resulting in error.

I'm thoug able to install orchard the manual way thorugh browser, but than when i want to run command line tools I'm getting the similar error.

Here is the error message when running seutp:
Error executing command "setup"
--------------------------------------------------------------------------------

A delegate registered to create instances of 'System.Web.HttpContextBase' returned null.

Exception Details: Autofac.Core.DependencyResolutionException: A delegate registered to create instances of 'System.Web.HttpContextBase' ret
urned null.

Stack Trace:

[DependencyResolutionException: A delegate registered to create instances of 'System.Web.HttpContextBase' returned null.]
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\Project
s\OSS\autofac\Core\Source\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 70
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 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 6
1
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration regist
ration, IEnumerable`1 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\Activ
ators\Reflection\ConstructorParameterBinding.cs:line 114
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\Pro
jects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving
\InstanceLookup.cs:line 79
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\L
ifetime\LifetimeScope.cs:line 270
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 6
4
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration regist
ration, IEnumerable`1 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\Activ
ators\Reflection\ConstructorParameterBinding.cs:line 114
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\Pro
jects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving
\InstanceLookup.cs:line 79
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\L
ifetime\LifetimeScope.cs:line 270
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 6
4
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration regist
ration, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 123
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) in c:\Projects\OSS\auto
fac\Core\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 85
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in c:\Projects\OSS
\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:line 232
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
 in c:\Projects\OSS\autofac\Core\Source\Autofac\ResolutionExtensions.cs:line 736
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) in c:\Projects\OSS\a
utofac\Core\Source\Autofac\ResolutionExtensions.cs:line 343
   at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\So
urce\Autofac\ResolutionExtensions.cs:line 197
   at Orchard.Environment.WorkContextImplementation.Resolve[T]() in C:\Users\Ivan Milanovic\Downloads\Software\Orchard\Orchard.Source.1.8.1\
src\Orchard\Environment\WorkContextImplementation.cs:line 19
   at Orchard.Environment.WorkContextAccessor.ThreadStaticScopeImplementation.Resolve[TService]() in C:\Users\Ivan Milanovic\Downloads\Softw
are\Orchard\Orchard.Source.1.8.1\src\Orchard\Environment\WorkContextAccessor.cs:line 137
   at Orchard.Setup.Services.SetupService.CreateTenantData(SetupContext context, IWorkContextScope environment) in e:\Dev\R&D\Orchard\Orchar
d.Source.1.8.1_test2\src\Orchard.Web\Modules\Orchard.Setup\Services\SetupService.cs:line 176
   at Orchard.Setup.Services.SetupService.Setup(SetupContext context) in e:\Dev\R&D\Orchard\Orchard.Source.1.8.1_test2\src\Orchard.Web\Modul
es\Orchard.Setup\Services\SetupService.cs:line 165
   at Orchard.Setup.Commands.SetupCommand.Setup() in e:\Dev\R&D\Orchard\Orchard.Source.1.8.1_test2\src\Orchard.Web\Modules\Orchard.Setup\Com
mands\SetupCommand.cs:line 66

--------------------------------------------------------------------------------

Command returned non-zero result: Fail
Feb 11, 2015 at 2:16 AM
Any luck solving this? I'm running into the same issue...
Feb 11, 2015 at 4:24 AM
Just downloaded a fresh copy of 1.8.1, still getting the same error on all commands. What environmental factors could be causing this?
Feb 11, 2015 at 11:37 AM
Feb 11, 2015 at 11:45 AM
Nope, sorry. My workaround was to clone the git repo and work with that version. Git repo is not generating this exception.
Feb 11, 2015 at 12:43 PM
Okay so the command line works for me in 1.7.1, but not in 1.8.1 or 1.x... what's going on? o0 Debugging 1.7.1 now to try and find any differences... which there obviously are; that it can create the HttpContextBase ^_^
Feb 12, 2015 at 8:45 AM
Edited Feb 12, 2015 at 8:45 AM
Maybe I'll just need to reinstall windows... great
May 11, 2015 at 12:32 AM
Same issue here. Using the 1.7.x branch works.
Sep 6, 2015 at 10:52 PM
Edited Sep 6, 2015 at 10:53 PM
Hazza - How did you end up resolving your issue? I'm running into the exact same thing and wondering if I should just start rebuilding my machine. My issue started without any changes to the code base.
Sep 9, 2015 at 9:05 PM
I don’t believe I did, I think I just upgraded Orchard to the latest version to fix the issue :| pretty fucking shit situation to be honest, cant do any development on my home machine on older versions of Orchard, of which I have several sites.

Sorry dude

Sent from Windows Mail

Coordinator
Sep 9, 2015 at 10:24 PM
I think this fix should solve the issue:
https://github.com/OrchardCMS/Orchard/commit/e118695ea728b0aaadf0d5497594508814e5245f

But upgrading to 1.9 should not be that difficult, is there anything blocking you? Or just painful?
Jan 19 at 4:34 AM
I have the same issue as this with Orchard 1.8.2 & visual Studio 2015. I have tried Sebastien's fix above but it made no difference.
Is there a solution to this other than upgrading to 1.9?