umbraco / UmbracoDocs

The official Umbraco Documentation
https://docs.umbraco.com
MIT License
269 stars 780 forks source link

Umbraco Forms and Autofac #999

Closed AstuteMediaDev closed 6 years ago

AstuteMediaDev commented 6 years ago

We ran into a problem on a new site build with the latest versions of Umbraco and Forms which also uses Autofac.

Umbraco 7.12.3 Umbraco Forms 7.0.4 Autofac 4.0.1

After installing forms we were getting 500 backoffice errors on the GetSections endpoint.

The solution marked in this post seems to have solved the problem i.e. register controllers in one of the Forms assemblies:

https://our.umbraco.com/forum/umbraco-7/using-umbraco-7/61745-Failed-to-retrieve-data-for-application-tree-forms-AutoFac-IOC-Umbraco-722-and-Forms

However that was posted three years ago and we're not sure if this is still the correct approach.

It would be useful to have a brief bit of documentation on how to configure Forms for IOC, specifically Autofac in our case.

Edit:

There's another related solution in this thread from 2016 which registers both standard and api controllers (final post isn't marked as solution):

https://our.umbraco.com/forum/umbraco-forms/81804-unable-to-create-forms-no-document-tree-on-440

sofietoft commented 6 years ago

Hi @AstuteMediaDev

I've had a chat with our Forms expert, Warren, about this. We already have some documentation about how to use IOC and AutoFac with Umbraco: https://our.umbraco.com/Documentation/Reference/using-ioc

What you are reporting here, seems like a niche case, and we do not have any recommended way of doing it. If the examples from the forum posts works, I'd say go for those! You are of course very welcome to create some documentation about this if you want 😁

For now I'll close this issue. Thanks! -Sofie