Orchard: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.

After deploying Orchard CMS and filling out the setup form, I got the following error:

Server Error in ‘/orchard’ Application.


Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.

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: System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.

Source Error:

 

Line 23: @if (Model.Messages != null) {

Line 24: <div id=”messages”>

Line 25: @Display(Model.Messages)

Line 26: </div>

Line 27: }

Source File: c:\inetpub\wwwroot\orchard\Themes\SafeMode\Views\Layout.cshtml Line: 25

Stack Trace:

 

[ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.]

Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScope.cs:222

Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy.<>c__DisplayClass4.<CreateDelegate>b__3(DisplayContext context) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs:52

Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55

Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:179

Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:88

Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:86

Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:44

Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:29

CallSite.Target(Closure , CallSite , Object , Object ) +220

System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +975

ASP._Page_Themes_SafeMode_Views_Layout_cshtml.Execute() in c:\inetpub\wwwroot\orchard\Themes\SafeMode\Views\Layout.cshtml:25

System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280

System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126

System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196

System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +158

Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:142

Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>c__DisplayClass28.<Discover>b__15(DisplayContext displayContext) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:126

Orchard.DisplayManagement.Descriptors.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:55

Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:179

Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:88

Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:86

Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:44

Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:29

CallSite.Target(Closure , CallSite , Object , Object ) +220

System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +975

Orchard.Mvc.ViewEngines.ThemeAwareness.<>c__DisplayClass7.<FindView>b__5(ViewContext viewContext, TextWriter writer, IViewDataContainer viewDataContainer) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\Mvc\ViewEngines\ThemeAwareness\LayoutAwareViewEngine.cs:63

Orchard.Mvc.ViewEngines.ThemeAwareness.LayoutView.Render(ViewContext viewContext, TextWriter writer) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\Mvc\ViewEngines\ThemeAwareness\LayoutAwareViewEngine.cs:90

System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378

System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +33

System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172

System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172

System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172

System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172

System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172

System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265

System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +854224

System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +40

System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15

System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65

System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15

System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51

System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42

System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15

System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51

Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in c:\svn\trunk\src\Apps\Orchard\src\Orchard\Mvc\Routes\ShellRoute.cs:159

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

 


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

Once again, the error message doesn’t really help much. The problem was actually that I had given full access rights for the DefaultAppPool user to the App_Data folder but not to the whole orchard folder.

Once I’ve given full rights to the whole folder:

Permissions for Orchard

and resent the form, everything worked fine.

Leave a Reply

Your email address will not be published.