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
    0

    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.Remove(FilterProviders.Providers.OfType<FilterAttributeFilterProvider>().First());
    FilterProviders.Providers.Add(new UnityFilterAttributeFilterProvider(UnityConfig.Container));
    

    the backoffice works okay.

    When I login to backoffice one of the requests is:

    http://umbraco.tutorial.com/umbraco/ServerVariables?umb__rnd=733e9a4f5fd56cd839cc3f2a9739803f

    returns message:

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

  • Gareth Evans 142 posts 334 karma points c-trib
    Aug 15, 2018 @ 00:26
    Gareth Evans
    100

    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:

Draft