None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters

Topics: Installing Orchard, Troubleshooting
Mar 6, 2012 at 2:48 PM

I am trying to set up an Orchard site on a shared hosting environment. I made sure the site ran locally, but I didn't configure it yet. I made sure it could get me to the setup screen.

I then pushed the site out to the shared hosting using FTP and tried to access the site. When I navigate there, I am getting the following exception instead of the setup screen.

Server Error in '/' Application.

None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Autofac.Core.DependencyResolutionException: None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 

[DependencyResolutionException: None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.]
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +463
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +122
   Autofac.Core.Resolving.InstanceLookup.Execute() +164
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +201
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +40
   Autofac.Core.Registration.<>c__DisplayClass8.<RegistrationsFor>b__3(IComponentContext c, IEnumerable`1 p) +30
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +15
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +30
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +89
   Autofac.Core.Resolving.InstanceLookup.Execute() +181
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +201
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +188
   Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +189
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +168
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +117
   Orchard.Environment.ShellBuilders.ShellContextFactory.CreateSetupContext(ShellSettings settings) in ShellContextFactory.cs:113
   Orchard.Environment.DefaultOrchardHost.CreateAndActivateShells() in DefaultOrchardHost.cs:145
   Orchard.Environment.DefaultOrchardHost.BuildCurrent() in DefaultOrchardHost.cs:104
   Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.Initialize() in DefaultOrchardHost.cs:68
   Orchard.Web.MvcApplication.HostInitialization(HttpApplication application) in Global.asax.cs:51
   Orchard.WarmupStarter.<>c__DisplayClass3.<LaunchStartupThread>b__2(Object state) in Starter.cs:89

[ApplicationException: Error during application initialization]
   Orchard.WarmupStarter.Starter`1.OnBeginRequest(HttpApplication application) in Starter.cs:63

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +152
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +393
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35
   System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +74
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

Coordinator
Mar 6, 2012 at 7:25 PM

This might means that you pushed too much dlls which are not needed, and Orchard thinks it's already fully compiled. You should use WebMAtrix starting from a Orchard.Web isntall, not the source code. Otherwise can you describe what you downloaded and how you are working with it ?

Mar 6, 2012 at 7:51 PM

I used the Web Platform Installer to set up a WebMatrix site, which I then deployed using FTP to my host. 

That's literally all I did to get this issue.

However, I've actually just gotten the site running. I asked the hosting company to assist and they said they grabbed the compiled download from the site and not from the Web Platform Installer, and it seems to have worked correctly. I was under the impression that these were the same files, so I don't know why it's working now. 

I had tried uploading the files a few times and from different computers, so I am not sure what could have been the issue.

Apr 6, 2012 at 8:07 PM

I'm on source code enlistment, on rev 6108, had to remove the warmup module from the web.config or I was getting the same issue.

I am running on a new windows 8 with vs 11 setup, in my case it might have to do with that, so far so good with the rest :)

Apr 11, 2012 at 12:54 PM

For me this was caused by deleting all the *.txt files. In order to get a clean deploy I deleted as much files as I could and discovered that when I deleted *.txt files, this exception would show up.

Coordinator
Apr 11, 2012 at 7:48 PM

Yes, and the solution is simple: don't delete .txt files ;)

Apr 14, 2012 at 6:49 PM

The error is a result of modules loaded by the DynamicExtensionLoader rather than with the PrecompiledExtensionLoader.

A new installation using ftp will timestamp the .csproj files later than the .dll files in each of the module directories due of the order of copying the files where a local file copy will preserve the dates and times.

The former forces the DynamicExtensionLoader to be used and the latter the PrecompiledExtensionLoader - and the bad news is it appears that modules loaded by DynamicExtensionLoader no longer function at all in Orchard 1.4.1.

The Stack Trace above is the result of Orchard.Setup loaded by the DynamicExtensionLoader - other modules may not be so obvious to detect, from missing in admin menu to missing routes generating NOT FOUND errors, although under Full Trust in Modules Admin there is a missing reference warning but not under Medium Trust.

Results of testing modules loaded with DynamicExtensionLoader:

Orchard Autofac Full Trust Medium Trust
1.3.10 2.2.4.900 OK OK
1.4 2.5.2.830 OK X
1.4.1 2.6.1.841 X X

To reproduce locally error create a new site from a file copy and update the Orchard.Setup.csproj to force DynamicExtensionLoader to load module - browse your site in expectation of the Setup page - result error and Stack Trace.

Note for version 1.4 only occurs at Medium Trust setting and not at all for earlier versions - the load method for the Setup module can be verified from the App_Data/Dependencies/dependencies.xml file.

Apr 18, 2012 at 1:46 PM
Edited Apr 18, 2012 at 1:52 PM

@filetek  What is the solution? I have the same problem on shared hosting

 

Server Error in '/' Application.

None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Autofac.Core.DependencyResolutionException: None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[DependencyResolutionException: None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.]
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +375
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__6() +11
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +106
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +164
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +23
   Autofac.Core.Registration.<>c__DisplayClass8.<RegistrationsFor>b__3(IComponentContext c, IEnumerable`1 p) +19
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +17
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +30
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.Execute() +48
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +164
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +70
   Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +155
   Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +72
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +121
   Autofac.ResolutionExtensions.Resolve(IComponentContext context) +53
   Orchard.Environment.ShellBuilders.ShellContextFactory.CreateSetupContext(ShellSettings settings) in ShellContextFactory.cs:113
   Orchard.Environment.DefaultOrchardHost.CreateSetupContext() in DefaultOrchardHost.cs:164
   Orchard.Environment.DefaultOrchardHost.CreateAndActivateShells() in DefaultOrchardHost.cs:144
   Orchard.Environment.DefaultOrchardHost.BuildCurrent() in DefaultOrchardHost.cs:104
   Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.Initialize() in DefaultOrchardHost.cs:68
   Orchard.Web.MvcApplication.HostInitialization(HttpApplication application) in Global.asax.cs:48
   Orchard.WarmupStarter.<>c__DisplayClass3.<LaunchStartupThread>b__2(Object state) in Starter.cs:89

[ApplicationException: Error during application initialization]
   Orchard.WarmupStarter.Starter`1.OnBeginRequest(HttpApplication application) in Starter.cs:63
   Orchard.Web.MvcApplication.Application_BeginRequest() in Global.asax.cs:29

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +335
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
   System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +57
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Apr 18, 2012 at 2:05 PM

It sounds like the solution is zip up the files, post them to FTP, and ask the hosting company to unzip them in the directory. You need the files to not be timestamped by the FTP process.

Apr 18, 2012 at 3:11 PM
Edited Apr 18, 2012 at 3:13 PM

Can I force it to all be compiled using PrecompiledExtensionLoader option?

Apr 18, 2012 at 3:45 PM

Via ftp re-copy the bin directory for each of the Modules, /Modules/Orchard.Setup/bin, etc - the timestamp for the .dlls should now be later than the .csproj files you previously copied.

If you have not set up Orchard you can delete the contents of App_Data and restart the application - re-copy Web.config and Global.asax.

When you browse your site you should eventually get the Setup page once Orchard has copied and loaded all the modules - you can verify the way Orchard loaded the modules from the file /App_Data/Dependencies/dependencies.xml - the LoaderName for each module should be PrecompiledExtensionLoader and the .dll present in /App_Data/Dependencies.

Jun 25, 2012 at 2:23 PM
Edited Jun 25, 2012 at 7:12 PM

I'm running into this error on a new install (extracted files from the Orchard.Web.1.4.2.zip file).  I've tried about everything I can think of to get by it and everything in this post with no luck.  Any help would be appreciated. A Lot.

Adrian

 

***UPDATE***

Our environment runs off two load balanced servers.  The site in question is running fine on one server but not the other.  The only thing I can think of is some sort of permission difference that I can't find.

 

***LAST UPDATE***

My problem was I forgot that the replication between the servers ignores txt files. (kind of need them). #ImAmoron

Jul 6, 2012 at 7:17 PM
Edited Jul 6, 2012 at 7:22 PM

I installed Orchard using these instructions:

http://docs.orchardproject.net/Documentation/Working-with-Orchard-in-WebMatrix

But when I click Run in the WebMatrix window, the browser displays this error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func`1[Autofac.Features.OwnedInstances.Owned`1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable`1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
 
I don't know how to resolve this error. I welcome any suggestions, thank you!
Anna
Jul 9, 2012 at 9:49 PM

I got the same error message. I used WebMatrix (v1) to create a new site from webgallery, chose 'Orchard CMS' (of course!) and after completion the error shows up. I resolved it by stopping the site and deleted the 'Dependencies' folder inside the App_Data folder. Then started the site again and it worked fine.

Aug 29, 2013 at 4:02 AM
Today is 2013 now, I still meet the same problem.
I have to package the files to a zip file and upload to ftp, then I developed a simple web application which can unzip it, then everything works.
If anyone need my unzip tool, please contact me.
Aug 29, 2013 at 5:55 PM
I had several problems deploying Orchard to Azure and got so tired of it that I moved to Wordpress. After strugling with Orchard for days and days, it took me literaly 15 mins. to get my blog up and running. I any one is is in the position to move or start with Wordpress I would strongly advise to do so.
Coordinator
Aug 29, 2013 at 7:37 PM
Stephan, I'm sorry you hit difficulties, and hope WordPress works well for you. It's a great and mature blogging platform. It would be nice if you could share what those difficulties were however, so we can improve our user experience.
Aug 30, 2013 at 2:06 PM
I wasn't able to deploy orchard on Azure, I hit the problems discussed in the thread and wasn't able to solve them. At that time, WordPress on Azure also became available and it was just so much easier setting it up I switched to it.

cheers, Stephan


Coordinator
Aug 30, 2013 at 9:06 PM
Could you be more specific as the thread mentions several things:
  • did you use Webmatrix, and which version ?
  • did you upload by FTP or by Web Deploy (publish button in WM)
  • how did you get the content you tried to deploy ?
Thanks
Sep 27, 2013 at 10:43 AM
To add to this, I also have spent days and days trying to get Orchard running on Azure.

I had no azure tools installed locally before I started, and downloaded the latest version - 2.1. I think this may be the start of my problems.

First of all I was getting "Could not load Microsoft.WindowsAzure.ServiceRuntime - no file could be found"
I switched it to "copy local" and tried again
Next I got "Could not load Microsoft.WindowsAzure.ServiceRuntime - version number doesn't match manifest" or something similar.
I added a redirect into the web.config, redirecting versions 1.7 and 1.8 to newVersion 2.1.
Next I got the message which is the title of this thread.....No idea how to diagnose the problem now, though.

I'm using VS2012 with a vanilla Orchard 1.7.1 source-code drop. I'm deploying from my local machine using VS2012 Publish in the "Cloud Service" project.

(I haven't switched back to Wordpress yet because creating a stand-alone EC2 server running Orchard + SQL Express was very straightforward)

Any help / suggestions appreciated :)
Coordinator
Sep 27, 2013 at 5:47 PM
Have you followed the instruction in the documentation ? I have tried them myself and it worked pretty well. If you did, then I will try again. If I can't repro then I will contact you.
Sep 27, 2013 at 8:45 PM
Yes, followed this documentation http://docs.orchardproject.net/Documentation/Deploying-Orchard-to-Windows-Azure to get all the errors I got.
Feb 7, 2014 at 11:54 AM
I had the same issue and I've deleted DLL files on FTP (shared hosting, full trust) and reapplied them. Now it seems to be working, so I can only assume it was timestamp problem as mentioned above.