Umb. 7.0.4 + Autofac = "Failed to retrieve data for application tree content"
Hello,I have a class "DependecyConfig" which is called from Global.asax on OnApplicationStarting.
DependecyConfig.cs
public static IContainer RegisterDependencies(Assembly currentAssembly) {
var builder = new ContainerBuilder();
// Register the controllers. builder.RegisterControllers(currentAssembly); builder.RegisterApiControllers(currentAssembly);
builder.RegisterFilterProvider();
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container);
return container; }
So there is an error while parsing Umbraco Nodes
Failed to retreive data for application tree content
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
at Umbraco.Web.Trees.ApplicationTreeExtensions.TryLoadFromControllerTree(ApplicationTree appTree, String id, FormDataCollection formCollection, HttpControllerContext controllerContext)
at Umbraco.Web.Trees.ApplicationTreeController.<GetRootForSingleAppTree>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Umbraco.Web.Trees.ApplicationTreeController.<GetApplicationTrees>d__4.MoveNext()
I've just run into the problem, I'm using Umbraco 7.1.1 with Autofac 3.3.1. I've followed the steps in this post (http://our.umbraco.org/forum/developers/api-questions/41794-Web-API-UmbracoApiController-does-not-use-DependencyResolver?p=1), but still the back office is throwing the same exception.
I've solved my problems with Umbraco 7.1.1 and Autofac 3.3.1. Here's what I did:
Install-Package Autofac.Mvc4
Install-Package Autofac.WebApi
Then, initialize Autofac as follows:
public static void Initialize()
{
var builder = new ContainerBuilder();
// Register umbraco context, mvc controllers and api controllers
builder.Register(c => UmbracoContext.Current).AsSelf();
builder.RegisterControllers(Assembly.GetExecutingAssembly());
builder.RegisterApiControllers(typeof(UmbracoApplication).Assembly);
// Register application specific types
RegisterTypes(builder);
var container = builder.Build();
var resolver = new AutofacWebApiDependencyResolver(container);
GlobalConfiguration.Configuration.DependencyResolver = resolver;
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
}
Umb. 7.0.4 + Autofac = "Failed to retrieve data for application tree content"
Hello,I have a class "DependecyConfig" which is called from Global.asax on OnApplicationStarting.
DependecyConfig.cs
public static IContainer RegisterDependencies(Assembly currentAssembly)
{
var builder = new ContainerBuilder();
// Register the controllers.
builder.RegisterControllers(currentAssembly);
builder.RegisterApiControllers(currentAssembly);
builder.RegisterFilterProvider();
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container);
return container;
}
So there is an error while parsing Umbraco Nodes
Failed to retreive data for application tree content
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
I have sql 2008 r2 server. So i dont think this is MySQL.
Can you have a look at the last post on this page : http://our.umbraco.org/forum/developers/api-questions/41794-Web-API-UmbracoApiController-does-not-use-DependencyResolver?p=1
Maybe this code can help you out
Dave
@Bouy - did you resolve the problem?
I've just run into the problem, I'm using Umbraco 7.1.1 with Autofac 3.3.1. I've followed the steps in this post (http://our.umbraco.org/forum/developers/api-questions/41794-Web-API-UmbracoApiController-does-not-use-DependencyResolver?p=1), but still the back office is throwing the same exception.
Update:
I've solved my problems with Umbraco 7.1.1 and Autofac 3.3.1. Here's what I did:
I hope that helps others solve this problem.
Lifesaver - thanks! The key to resolving the issue for me was this line:
UmbracoCms 7.5.2 & Autofac.Mvc5 & Autofac.WebApi2
Helped me. Had the exact same error.
Thanks Tom for posting the fix.
Same here!
Thanks Tom.
check out this video : https://www.youtube.com/watch?v=sDQwu_DzYyc
This fixed my issue too, with the slight difference that my controllers are in a separate project. I added the following line to resolve this:
This is exactly I need
bit late to this party, but had this issue and fixed with
This also saved me! Thanks for posting Tom! Proves how many people a post can help out over the years!
is working on a reply...