Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Nikolay Yeryomenko 7 posts 97 karma points
    Aug 12, 2018 @ 10:35
    Nikolay Yeryomenko

    Umbraco 7.11 and Unity.Mvc 5.0, Unity.AspNet.WebApi 5.0

    What is the correct way to use Unity 5.0 with Umbraco 7.11?

    When I use Unity from Nuget backoffice stops to work (shows blank page).

    When I comment lines UnityMvcActivator.cs:

    FilterProviders.Providers.Add(new UnityFilterAttributeFilterProvider(UnityConfig.Container));

    the backoffice works okay.

    When I login to backoffice one of the requests is:

    returns message:

    The type UmbracoAuthorizeAttribute has multiple constructors of length 1. Unable to disambiguate.

  • Gareth Evans 139 posts 330 karma points c-trib
    Aug 15, 2018 @ 00:26
    Gareth Evans

    Just fixed this during an upgrade, here's my UnityWebActivator

    container.RegisterType<UmbracoContext>(new ContainerControlledLifetimeManager(), new InjectionFactory(c => UmbracoContext.Current)); container.RegisterType<UmbracoAuthorizeAttribute>(new ContainerControlledLifetimeManager(), new InjectionConstructor(typeof(UmbracoContext))); //prefer the constructor that takes UmbracoContext

Please Sign in or register to post replies

Write your reply to: